Hi!
As far as I can see, there seems to be some bug in ZippedJarVisitor in the distributed version of hibernate-entitymanager.jar beta2:
The extraction of the jarFileName in the constructor does not work under linux. I packaged a .par file inside an .ejb3 file, and when Hibernate tried to "visit" the par,
an exception occurred.
Code:
public ZippedJarVisitor(URL url, boolean detectClasses, boolean detectHbm) {
this.detectClasses = detectClasses;
this.detectHbm = detectHbm;
String file = url.getFile();
jarFileName = file.substring( "file:/".length(), file.length() - "!/META-INF/persistence.xml".length() );
unqualify();
}
"url" has as value something like "file:/home/...", so the created substring has no leading slash. On Windows, this is fine, but on linux this is interpreted as a relative path, causing the following exception:
Code:
java.util.zip.ZipException: No such file or directory
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:204)
at java.util.jar.JarFile.<init>(JarFile.java:132)
at java.util.jar.JarFile.<init>(JarFile.java:70)
...
I got this Exception with JBoss-4.0.2 in combination with JBoss EJB3 RC1, Java 1.5.0_04 and Suse 9.3, and when I patched the above to
jarFileName = file.substring(
"file:".length(), file.length() - "!/META-INF/persistence.xml".length() );
the bug was gone, but this solution wouldn't work on Windows anymore. Is this a bug, or is there some incompatibility that might be responsible for that behaviour?
Thanks,
Stephan
Code: