ChuongPham
ChuongPham

Reputation: 4801

JSF 2 OpenJPA 2 Glassfish 3.1 WEB9031 Error

I got this error which according to Apache Support is an issue relating with Glassfish rather than OpenJPA:

java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped

The stacktrace is:

Caused by: java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1410)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
    at com.ckd.model.BookModel.pcNewObjectIdInstance(BookModel.java)
    at org.apache.openjpa.enhance.PCRegistry.newObjectId(PCRegistry.java:138)
    at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClass(MetaDataRepository.java:1693)
    at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClasses(MetaDataRepository.java:1643)
    ... 112 more

Has anyone come across this before and how to resolve it? I have been stuck on this issue for the last several days.

Another of my post related to this issue can be found here: JSF 2: h:link and getrowdata.

Upvotes: 1

Views: 1755

Answers (1)

ChuongPham
ChuongPham

Reputation: 4801

The above error relates to a problem with the OpenJPA enhancer. When you execute Sun's JDK the OpenJPA's dynamic enhancer starts by default. This action, in turn, stuffs up Glassfish's classloader class - hence, the WEB9031 error.

For those who experience this same issue, a simple workaround is to do the enhancement at build time - which I did in ANT with org.apache.openjpa.ant.PCEnhancerTask - and add this property to your persistence.xml to shut off the dynamic enhancer: <property name="openjpa.DynamicEnhancementAgent" value="false"/>.

Also, it wouldn't hurt to throw this in your persistence.xml as well <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />.

Upvotes: 1

Related Questions