JSF 2 OpenJPA 2 Glassfish 3.1 WEB9031 Error

痴心易碎 提交于 2020-01-03 01:46:14

问题


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.


回答1:


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" />.



来源:https://stackoverflow.com/questions/5622436/jsf-2-openjpa-2-glassfish-3-1-web9031-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!