0 Replies Latest reply on Dec 12, 2006 9:39 AM by derjohannes

    JAXB: java.lang.LinkageError when linking javax.xml.namespac

    derjohannes

      In my ear archive, I switched parent delegation to false, because JBoss would load the wrong JAXB classes otherwise (from the server/lib folder instead from the jars given in the ear).

      Now, the correct JAXB classes are loaded, but there is a new kind of problem:

      When I try a

      JAXBContext jaxbContext = JAXBContext.newInstance("com.foobar.item");
      

      (which is using the javax.xml.namespace.QName to create a binding between XML and Java)

      I get the following error:
      javax.ejb.EJBTransactionRolledbackException: java.lang.RuntimeException: java.lang.LinkageError: loader constraints violated when linking javax/xml/namespace/QName class
      


      On the following sites the same problem is described:

      http://www.mail-archive.com/jboss-user@lists.sourceforge.net/msg22483.html
      http://mail-archive.objectweb.org/oscar/2005-07/msg00055.html
      http://mail-archives.apache.org/mod_mbox/maven-issues/200603.mbox/%3C122476968.1143609944250.JavaMail.haus-jira@codehaus01.managed.contegix.com%3E

      What is the most "straightforward" way to solve this issue on a JBoss 4.0.4 AS?

      Removing the QName class from standard-jars does not seem to be very elegant, neither does copying the QName class in every bundle using it.

      I read

      http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration
      http://www.jboss.org/wiki/Wiki.jsp?page=JBossClassLoadingUseCases
      http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassCastExceptions

      and

      http://docs.jboss.org/jbossas/jboss4guide/r1/html/ch2.chapter.html#d0e2311

      and I think I understand the root cause of the problem (the QName class being loaded by two different class loaders). Nevertheless, I cannot solve the problem.


      Any help would be appreciated.

      DerJohannes