Jboss EAP 6.4:类sun.security.jca.GetInstance上的NoClassDefFoundError [英] JBoss EAP 6.4: NoClassDefFoundError on class sun.security.jca.GetInstance
问题描述
我有一个调用javax.crypto.SecretKeyFactory.getInstance
的部署.
类javax.crypto.SecretKeyFactory
似乎已正确加载,但是当该方法尝试创建实例时,它将在sun/security/jca/GetInstance
NoClassDefFoundError
查看OpenJDK8的源代码表明,相关的javax.crypto.SecretKeyFactory
构造函数显式引用了sun.security.jca.GetInstance
中的方法,因此尝试加载它是正常的.
奇怪的是,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el6.x86_64/jre/lib/rt.jar
中同时存在javax/crypto/SecretKeyFactory.class
和sun/security/jca/GetInstance.class
,但是类加载器只能找到前者.
jboss模块类加载器在玩什么,如何使它停止?
感谢您的建议.
我终于解决了我的问题,尽管不是上面建议的那样.如果没有帮助,我将无法到达那里(谢谢大家).
我确实设法解决了sun/security/jca访问问题,但是随后引发了另一个类似类型的问题,但带有javax类.通过从模块org/jboss/genericjms中删除一个jar并让jdk版本被获取,我发现了一个丑陋的修复方法,但是我觉得那与我无法预测其后果的东西玩得太紧了. /p>
我最终确定的解决方法是,将提供的引用javax/crypto/SecretKeyFactory的jar放在自己的新模块中,然后通过以下方式提取所需的类:
<system export="true">
<paths>
<path name="java/sql"/>
<path name="javax/crypto"/>
<path name="javax/crypto/spec"/>
<path name="javax/crypto/interfaces"/>
<path name="javax/management"/>
<path name="javax/security/auth/login"/>
<path name="sun/security/jca"/>
<path name="org/ietf/jgss"/>
</paths>
</system>
在module.xml中.当我从代码中引用这个新模块时,它就可以工作(实际上,我通过在standalone.xml中将其设为全局模块来将其引入).
问题解决了.尽管我不得不说,在对jboss模块化类加载器进行了这种体验之后,请每天给我一个分层的视图.
再次感谢您的帮助.
I have a deployment that calls javax.crypto.SecretKeyFactory.getInstance
.
The class javax.crypto.SecretKeyFactory
appears to load correctly, but when the method tries to create an instance it throws a NoClassDefFoundError
on sun/security/jca/GetInstance
Looking at the OpenJDK8 sources shows that relevant javax.crypto.SecretKeyFactory
constructor refers explicitly to a method in sun.security.jca.GetInstance
, so it's normal that it tries to load it.
What's odd is that both javax/crypto/SecretKeyFactory.class
and sun/security/jca/GetInstance.class
are present in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el6.x86_64/jre/lib/rt.jar
but that only the former is found by the classloader.
What is the jboss module classloader playing at and how can I get it to stop it?
Thanks for suggestions.
I finally fixed my problem, though not quite in the ways suggested above. I wouldn't have got there without the help though (thanks guys).
I did manage to fix the sun/security/jca access problem but it then threw up another problem of a similar type, but with a javax class. I found an ugly fix for that by removing a jar from module org/jboss/genericjms and letting the jdk version get picked up, but I felt that that was playing around too much with stuff that I couldn't predict the consequences of.
The fix I have finally settled on is to put the provided jar that references javax/crypto/SecretKeyFactory in a new module all of its own and then to pull in the classes it needs via:
<system export="true">
<paths>
<path name="java/sql"/>
<path name="javax/crypto"/>
<path name="javax/crypto/spec"/>
<path name="javax/crypto/interfaces"/>
<path name="javax/management"/>
<path name="javax/security/auth/login"/>
<path name="sun/security/jca"/>
<path name="org/ietf/jgss"/>
</paths>
</system>
in the module.xml. When I reference this new module from my code it works (I pulled it in by making it a global module in standalone.xml in fact).
Problem solved. Though I have to say that after this experience of the jboss modular class loader, give me a hierarchical one any day.
Thanks again for the help.
这篇关于Jboss EAP 6.4:类sun.security.jca.GetInstance上的NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!