Topic
  • 4 replies
  • Latest Post - ‏2011-08-10T21:47:15Z by bkail
SudeepMoses
SudeepMoses
1 Post

Pinned topic java.lang.LinkageError: loading constraint violation: loader

‏2010-04-12T14:06:32Z |
Hi,

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 7.0.0.7

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
Error Stack:
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)
at java.lang.ClassLoader.defineClass(ClassLoader.java:265)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:69)
at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:752)
at com.ibm.ws.classloader.CompoundClassLoader.localFindClass(CompoundClassLoader.java:671)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:512)
at java.lang.ClassLoader.loadClass(ClassLoader.java:609)

Thanks in advance
Updated on 2011-08-10T21:47:15Z at 2011-08-10T21:47:15Z by bkail
  • VPEDDI
    VPEDDI
    2 Posts

    Re: java.lang.LinkageError: loading constraint violation: loader

    ‏2011-01-01T14:06:21Z  
    Hello, even I'm getting the same errror. Can you please some one post the sollution.

    Thanks
    Peddi
  • VPEDDI
    VPEDDI
    2 Posts

    Re: java.lang.LinkageError: loading constraint violation: loader

    ‏2011-01-01T14:07:07Z  
    Hello, even I'm getting the same errror. Can some one please post the solution.

    Thanks
    Peddi
  • g-citi
    g-citi
    1 Post

    Re: java.lang.LinkageError: loading constraint violation: loader

    ‏2011-08-10T21:08:35Z  
    • VPEDDI
    • ‏2011-01-01T14:07:07Z
    Hello, even I'm getting the same errror. Can some one please post the solution.

    Thanks
    Peddi
    check if you have stax-api*.jar in your war. If it is, exclude it. It worked for me.
  • bkail
    bkail
    372 Posts

    Re: java.lang.LinkageError: loading constraint violation: loader

    ‏2011-08-10T21:47:15Z  
    • VPEDDI
    • ‏2011-01-01T14:06:21Z
    Hello, even I'm getting the same errror. Can you please some one post the sollution.

    Thanks
    Peddi
    The error only occurs when using PARENT_LAST. If possible, it's usually easier to use PARENT_FIRST.

    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)