添加EntityListeners之后的sun.reflect.annotation.TypeNotPresentExceptionProxy异常 [英] sun.reflect.annotation.TypeNotPresentExceptionProxy exception after adding EntityListeners

查看:577
本文介绍了添加EntityListeners之后的sun.reflect.annotation.TypeNotPresentExceptionProxy异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 @EntityListeners(value = {MyEventListener.class})将EntityListeners添加到应用程序时,发生以下崩溃。反射似乎是一个问题。该应用程序具有为同一实体定义的自定义注释。请注意,此崩溃仅在添加EntityListeners之后发生。如果对自定义注释添加了注释,则应用程序仍将崩溃。奇怪的是,当通过Netbeans调试器运行时,相同的代码可以正常工作。 getAnnotation()调用将读取为该实体定义的所有注释。在调试器之外启动应用程序的那一刻,我崩溃了。我无法找到类加载器为何找不到MyEventListener.class的原因。

When an EntityListeners was added to the application using the @EntityListeners(value = {MyEventListener.class}), got the following crash. It looks an issue with reflection. The application has a custom annotation defined for the same entity. Note that this crash only happens after adding the EntityListeners. If the custom annotation is commented the application will still crash. The weird thing is that the same code will work fine when run through the Netbeans debugger. The getAnnotation() call will read all the annotations defined for the entity. The moment I launch the application outside the debugger I get the crash. I haven't been able to find why the class loader cannot 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?

推荐答案

问题很可能是以下情况:某些注释的值使用的类不在类路径中。

The issue is most probably the following: There's some annotation whose value uses a class which isn't in the classpath.

这里是一个简短的示例:

Here is a short exmample:

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

您必须确保在您的类路径中可以找到 Myclass。 (例如,将其打包到您的应用中)

You have to make sure that "Myclass" is available in your classpath. (e.g. by packaging it into your app)

这篇关于添加EntityListeners之后的sun.reflect.annotation.TypeNotPresentExceptionProxy异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆