加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

jpa – 添加EntityListeners后的sun.reflect.annotation.TypeNot

发布时间:2020-12-15 04:58:40 所属栏目:Java 来源:网络整理
导读:使用@EntityListeners(value = {MyEventListener.class})将EntityListeners添加到应用程序时,发生了以下崩溃.这看起来与反思有关.该应用程序具有为同一实体定义的自定义注释.请注意,此崩溃仅在添加EntityListeners后发生.如果注释了自定义注释,则应用程序仍
使用@EntityListeners(value = {MyEventListener.class})将EntityListeners添加到应用程序时,发生了以下崩溃.这看起来与反思有关.该应用程序具有为同一实体定义的自定义注释.请注意,此崩溃仅在添加EntityListeners后发生.如果注释了自定义注释,则应用程序仍将崩溃.奇怪的是,当通过Netbeans调试器运行时,相同的代码将正常工作. getAnnotation()调用将读取为实体定义的所有注释.我在调试器外部启动应用程序的那一刻,我得到了崩溃.我无法找到为什么类加载器找不到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)

有没有人看过这个,知道如何修复它?

解决方法

问题很可能如下:有一些注释,其值使用不在类路径中的类.

这是一个简短的例子:

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

您必须确保类路径中有“Myclass”. (例如,将其打包到您的应用中)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读