Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: Release 1.5.2
-
Fix Version/s: Release 1.5.3, Release 1.6
-
Component/s: None
-
Labels:None
Description
Hi,
Deploying stripes 1.5.2 examples on WebLogic fails as Actions are not discovered at runtime.
Seems the problem is in ResolverUtil.findJarForResource method:
368 protected URL findJarForResource(URL url, String path) throws MalformedURLException {
...
373 for (;
{
374 url = new URL(url.getFile());
375 log.trace("Inner URL: ", url);
376 }
The incoming url might look like this on Tomcat:
jar:file:/C:/apps/tomcat/tmp/WEB-INF/lib/myjar.jar!/com.mycorp.actions
After line 374 is executed the url becomes:
file:/C:/apps/tomcat/tmp/WEB-INF/lib/myjar.jar!/com.mycorp.actions
For WebLogic the incoming url is:
zip:C:/apps/mywar/WEB-INF/lib/mylib.jar!/com.mycorp.actions
Line 374 fails on the first attempt and the url is unchanged.
Later on in the method a check is made whether the url is a jar and on WebLogic the check fails with a FileNotFoundException.
One possible fix is to check for the "zip:" prefix and strip it, creating a new URL:
String urlStr = jarUrl.toString();
if (urlStr.startsWith("zip:")) {
urlStr = urlStr.substring(4);
url = new File(urlStr).toURL();
if (isJar(testUrl)) {
return testUrl;
}
}
kind regards
bob
Alternatively, instead of checking for the zip prefix a check can be made against the url file attribute since it points to the underlying jar.
For example the WebLogic url might be:
zip:C:/apps/mywar/WEB-INF/lib/mylib.jar!/com.mycorp.actions
Calling url.getFile() returns:
C:/apps/mywar/WEB-INF/lib/mylib.jar!/com.mycorp.actions
Maybe a check can be done against the url.getFile() if isJar fails the first time?
415 // Try to open and test it
416 try {
417 URL testUrl = new URL(jarUrl.toString());
418 if (isJar(testUrl)) { 419 return testUrl; } else {
String pathToUrl = url.getFile();
pathToUrl = ...// extract jar path from string
testUrl = new File(pathToUrl).toURL();
if (isJar(testUrl)) { return testUrl; }
}
420 }
421 catch (MalformedURLException e) { 422 log.warn("Invalid JAR URL: ", jarUrl); 423 }