i'm trying to integrate a j2ee product with the security product of our client. the problem is the the javax.xml.namespace.QName class is present in 2 jars one in the product and another in websphere. The security components use the websphere jar and the other class is used by the application. i tried modifying the classloader, used both parent first and parent last. but still i get the following exception. we are using websphere 184.108.40.206
Error Message: java.lang.LinkageError: loading constraint violation: loader "com/ibm/ws/classloader/CompoundClassLoader@27402740" previously initiated loading for a different type with name "javax/xml/namespace/QName" defined by loader "com/ibm/oti/vm/BootstrapClassLoader@53c253c2"
Error Code: 500
Target Servlet: null
java.lang.LinkageError: loading constraint violation: loader "com/ibm/ws/classloader/CompoundClassLoader@27402740" previously initiated loading for a different type with name "javax/xml/namespace/QName" defined by loader "com/ibm/oti/vm/BootstrapClassLoader@53c253c2"
at java.lang.ClassLoader.defineClassImpl(Native Method)
Thanks in advance
Pinned topic java.lang.LinkageError: loading constraint violation: loader
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2011-08-10T21:47:15Z at 2011-08-10T21:47:15Z by bkail
g-citi 270002Y2QA1 Post
bkail 120000PS1Y372 Posts
Re: java.lang.LinkageError: loading constraint violation: loader2011-08-10T21:47:15ZThis is the accepted answer. This is the accepted answer.
- VPEDDI 270003T5AK
Regardless, the error indicates you have included javax.xml.namespace.QName in your application. If at all possible, I would strongly recommend you remove all javax.* classes from your application.
Otherwise, the error means you are using some other class that depends on QName (e.g., javax.xml.ws.Service), but you have not overridden that other class in your application. The JVM requires that class loaders have a "consistent" view of classes, but you have broken that rule because your app has visibility to two versions of the QName class:
1. the one loaded directly by your app (because you've included QName in your EAR and you've used PARENT_LAST)
2. the one loaded by WAS that is referenced indirectly via some other class (e.g., Service) that was also loaded by WAS (because you have not included that other class in your app)