本文介绍了JSF 2 OpenJPA 2 Glassfish 3.1 WEB9031错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误,根据Apache支持,这是与Glassfish而不是OpenJPA有关的问题:

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

堆栈跟踪为:

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.

与该问题有关的另一篇文章可以在这里找到: JSF 2:h:link和getrowdata .

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

推荐答案

上述错误与OpenJPA增强器的问题有关.当您执行Sun的JDK时,默认情况下会启动OpenJPA的动态增强器.反过来,此操作将填满Glassfish的类加载器类-因此,出现 WEB9031 错误.

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.

对于那些遇到相同问题的人,一个简单的解决方法是在构建时进行增强-这是我在ANT中使用org.apache.openjpa.ant.PCEnhancerTask完成的-并将此属性添加到您的 persistence.xml 中,关闭动态增强器:<property name="openjpa.DynamicEnhancementAgent" value="false"/>.

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

此外,将其扔到 persistence.xml <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />中也没什么坏处.

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

这篇关于JSF 2 OpenJPA 2 Glassfish 3.1 WEB9031错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 12:19