JPA – sun. After adding entitylisteners reflect. annotation. Typenotpresentexceptionproxy exception

The following crash occurred when adding entitylisteners to the application using @ entitylisteners (value = {myeventlistener. Class}) This seems to have something to do with reflection The application has custom annotations defined for the same entity Note that this crash occurs only after adding entitylisteners If custom comments are annotated, the application will still crash Strangely, the same code will work when running through the NetBeans debugger The getannotation () call will read all annotations defined for the entity The moment I started the application outside the debugger, I got a crash I can't find why the class loader can't find myeventlistener class.

at sun.reflect.annotation.AnnotationParser.parseClassArray(UnkNown Source)
at sun.reflect.annotation.AnnotationParser.parseArray(UnkNown Source)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(UnkNown Source)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(UnkNown Source)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(UnkNown Source)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(UnkNown Source)
at java.lang.Class.initAnnotationsIfNecessary(UnkNown Source)
at java.lang.Class.getAnnotation(UnkNown Source)
at com.Feedoffice.FOEDataCache.initializeInternalListeners(FOEDataCache.java:34)
at com.DataCache.<init>(DataCache.java:20)
at com.Feedoffice.FOEDataCache.<init>(FOEDataCache.java:16)
at com.Feedoffice.ClientDataCache.<init>(ClientDataCache.java:163)
at com.ClientDataCache.<clinit>(ClientDataCache.java:171)
at com.Feedoffice.forms.FOENumericTextFieldFactory.<init>(FOENumericTextFieldFactory.java:14)
at com.Feedoffice.forms.FOENumericTextFieldFactory.getInstance(FOENumericTextFieldFactory.java:24)
at com.Feedoffice.FOEApplet.displayMenu(FOEApplet.java:282)
at com.Feedoffice.FOEApplet.loginWindowClosed(FOEApplet.java:215)
at com.Feedoffice.forms.AppLogin.submitButtonClicked(AppLogin.java:49)
at com.Feedoffice.forms.AppLogin.performSubmitAction(AppLogin.java:106)

Has anyone seen this and knows how to fix it?

Solution

The problem is likely to be as follows: there are some comments whose values use classes that are not in the classpath

This is a short example:

@MyAnnotation (value = MyClass.class)
public class TestClass

You must ensure that there is "MyClass" in the classpath (for example, package it into your app)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>