本文介绍了在WAS Liberty环境中缺少NamedQueries注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我创建一个 NamedQuery ,代码编译,部署和运行正常。
但是,如果我尝试使用 NamedQueries 注释,我得到以下的奇怪:

  java.lang.ArrayStoreException:com.sun.proxy。$ Proxy29 
at sun.reflect.annotation.AnnotationParser.parseAnnotationArray(AnnotationParser.java:765)
at sun.reflect .annotation.AnnotationParser.parseArray(AnnotationParser.java:537)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser .java:286)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
在java.lang.Class.createAnnotationData(Class.java:3521)
在java.lang.Class.annotationData(Class.java:3510)
在java.lang.Class.getAnnotation(Class.java:3415)

经过一番调查,我发现以下两个错误:




  • Jboss中的ArrayStoreException:


  • ArrayStoreException当缺少注释类的注释:




似乎 javax.persistence.NamedQueries inteface在环境中缺少(stangely javax.persinstence.NameQuery存在...)



我使用Eclipse Kepler进行开发,部署也是由IDE处理
更多的东西;使用相同代码库的其他开发人员可以使用附带的设置成功部署和运行应用程序 - 所以我怀疑部署可能对此问题负责。



有没有办法要告诉WAS包含缺少的类运行时间?



感谢
krisy

解决方案

需要一些时间,但我找到了解决方案。



我们正在使用Ecliselink作为JPA提供商,并相应地加载它:

 < classloader commonLibraryRef =EclipseLinkLibdelegate =parentLast/> 

似乎Eclipselink(版本2.5.2)包含 javax.persistence .NamedQuery 接口,但不是 javax.persistence.NamedQueries 接口 - 这样WAS不加载缺少的接口。



通过更改 delegate =parentFirst应用可以正常工作。


I'm using WAS Liberty 8.5.5.5 under Java 7 (tried under Oracle java 7-8 and IBM java 7 as well).

When I create one NamedQuery, the code compiles, deployes, and runs fine.However, If I try to use the NamedQueries annotation I get the following excpetion:

java.lang.ArrayStoreException: com.sun.proxy.$Proxy29
                  at sun.reflect.annotation.AnnotationParser.parseAnnotationArray(AnnotationParser.java:765)
                  at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:537)
                  at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
                  at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
                  at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
                  at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
                  at java.lang.Class.createAnnotationData(Class.java:3521)
                  at java.lang.Class.annotationData(Class.java:3510)
                  at java.lang.Class.getAnnotation(Class.java:3415)

After some investigation, I found the following two bugs:

It seems that the javax.persistence.NamedQueries inteface is missing in the enviroment (stangely the javax.persinstence.NameQuery is present ...)

I use Eclipse Kepler for development, the deployment is also handled by the IDE.On more thing; other developers using the same code base can successfully deploy and run the application with the afformentioned settings - so I suspect the deployment might be responsible for this issue.

Is there a way to "tell" the WAS to include the missing class runtime?

Thanks,krisy

解决方案

It took some time, but I found the solution.

We are using Ecliselink as a JPA provider, and load it accordingly:

<classloader commonLibraryRef="EclipseLinkLib" delegation="parentLast"/>

It seems that Eclipselink (version 2.5.2) contains the javax.persistence.NamedQuery interface, but not the javax.persistence.NamedQueries interface - this way WAS does not load the missing interface.

By changing delegation="parentFirst" the app works fine.

这篇关于在WAS Liberty环境中缺少NamedQueries注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 03:49