Bug 377 : XmlConfigLoader breaks down when unable to open a jar from classpath
Priority 
High
Reported Version 
 
Logged By 
AK
Status 
Fixed
Fixed Version 
2.7.7
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
16/12/2011
Updated 
16/12/2011
Type 
Bug
 
Attachments 
No attachments

XmlConfigLoader iterates the jars from classpath and tries to locate orm.xml. If there's a missing jar or if the app doesn't have permissions to it, the opening of the jar may result in exception. The current behavior results in the whole server startup failure. Instead, it should just log a warning and move on to the next jar.

I changed XmlConfigLoader line 182 to catch "Exception" instead of "java.util.zip.ZipException" and it worked well. I think should be incorporated into EBean code because this was a show stopper for our deployment.

Here's a stack trace for a reference:


Caused by: java.io.FileNotFoundException: C:\Oracle\Middleware\jdk160_14_R27.6.5-32\jre\lib\sunrsasign.jar (The system cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:114)
at java.util.jar.JarFile.(JarFile.java:133)
at java.util.jar.JarFile.(JarFile.java:97)
at com.avaje.ebeaninternal.server.core.XmlConfigLoader.checkJar(XmlConfigLoader.java:176)
at com.avaje.ebeaninternal.server.core.XmlConfigLoader.search(XmlConfigLoader.java:110)
at com.avaje.ebeaninternal.server.core.XmlConfigLoader.load(XmlConfigLoader.java:78)
at com.avaje.ebeaninternal.server.core.DefaultServerFactory.(DefaultServerFactory.java:91)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
....
NoClassDefFoundError occured : Could not initialize class com.avaje.ebean.EbeanServerFactory

play.exceptions.JavaExecutionException: Could not initialize class com.avaje.ebean.EbeanServerFactory
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:231)
at play.server.ServletWrapper$ServletInvocation.execute(ServletWrapper.java:557)

 
Rob 14 Mar 10:55
Fixed in HEAD.

Quite right - thanks for that,fixed in HEAD.

woResponse

Upload a file