0 Replies Latest reply on Aug 21, 2003 4:13 PM by CHIAMING HSU

    loader constraints violated when using scoped class loading


      java.lang.LinkageError: loader constraints violated when linking org/xml/sax/EntityResolver

      I have a need to scope class loading at the EAR level so that some commonly used jars included with my EAR won't cause problem with other EAR / WAR deployed on the same JBoss instance (in this particular case, jini-ext.jar, but it could be other jars.)

      The above LinkageError is thrown when the class loading is scoped. Here is the output of the displayClassInfo() of the HeirarchicalLoaderRepository3 MBean through the jmx console for the particular class org.xml.sax.EntityResolver

      org.xml.sax.EntityResolver Information
      Repository cache version:
      org.xml.sax.EntityResolver(14174f9).ClassLoader=org.jboss.mx.loading.UnifiedClassLoader3@1ba1d9{ url=file:/opt/jboss/jboss-3.2.2RC2/server/default/tmp/deploy/tmp37927si3.ear ,addedOrder=32}
      ..org.jboss.mx.loading.UnifiedClassLoader3@1ba1d9{ url=file:/opt/jboss/jboss-3.2.2RC2/server/default/tmp/deploy/tmp37927si3.ear ,addedOrder=32}
      ++++CodeSource: (file:/opt/jboss/jboss-3.2.2RC2/server/default/tmp/deploy/tmp37927si3.ear-contents/katepult.war/WEB-INF/lib/xmlrpc-1.2-a1.jar )
      Implemented Interfaces:

      ### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@1ba1d9{ url=file:/opt/jboss/jboss-3.2.2RC2/server/default/tmp/deploy/tmp37927si3.ear ,addedOrder=32}

      ### Instance1 via UCL: org.jboss.system.server.NoAnnotationURLClassLoader@19efb05

      It looks like one instance is loaded by the scoped class loader and another is loaded by the system class loader.

      Is this a bug in JBoss?

      Shouldn't it be true that before the scoped class loader load this class, it should check and found that an instance has already being loaded by the system class loader?

      It is very difficult to remove this class (or other similar XML infrastructure interface classes) from all deployed jars since it is everywhere (in jdk 1.4.2, xerces, apache xmlrpc, etc.)

      This does not happen when the EAR do not use scoped class loading.

      I am using JBoss 3.2.2 RC 2 with SUN JDK 1.4.2