开发者

If my model class imports HttpServletRequest, Datanucleus enhancer throws NoClassDefFoundError

Is there a Datanucleus setting to prevent the enhancer throwing an error if the HttpServletRequest class is imported by the model class that is being enhanced?

Aug 11, 2011 11:06:34 PM org.datanucleus.enhancer.asm.JdoClassAdapter visitEnd
WARNING: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getDeclaredConstructors(Unknown Source)
        at java.io.ObjectStreamClass.computeDefaultSUID(Unknown Source)
        at java.io.ObjectStreamClass.access$100(Unknown Source)
        at java.io.ObjectStreamClass$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.io.ObjectStreamClass.getSerialVersionUID(Unknown Source)
        at org.datanucleus.enhancer.asm.JdoClassAdapter.visitEnd(JdoClassAdapter.java:338)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at org.datanucleus.enhancer.asm.ASMClassEnhancer.enhance(ASMClassEnhancer.java:355)
        at org.datanucleus.enhancer.DataNucleusEnha开发者_如何学Goncer.enhanceClass(DataNucleusEnhancer.java:974)
        at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:570)
        at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1252)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 15 more


You can restrict which classes are being enhanced, so just enhance the persistable ones. If you don't it will have to search for annotations and by doing that will need to load the class definition, and Java's class loader will complain if you don't have your dependencies in your classpath

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜