4 Replies Latest reply on Mar 25, 2014 11:02 AM by Stefan Neis

    LinkageError for duplicate javax.xml.ws.Service in JBoss module and Java runtime

    Stefan Neis Newbie

      Hi everybody.

      I am using a web service client class MyWebServiceClient extending javax.xml.ws.Service. The exception I get starting Wildfly 8.0.0 is this one here:

       

      java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, com/mypackage/MyWebServiceClient, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, javax/xml/ws/Service, have different Class objects for the type <init> used in the signature

       

      My first suggestion was that I have deployed a jar containing an additional Service class, but that isn't the mistake. The only jar files containing the class javax.xml.ws.Service are the one in the JBoss module javax.xml.ws.api (jboss-jaxws-api_2.2_spec-2.0.2.Final.jar) and the one in the rt.jar from the JDK. The output for two conflicting class loaders is as follows:

       

      Class loader for javax/xml/ws/Service:

      ModuleClassLoader for Module "javax.xml.ws.api:main" from local module loader @304e28a6 (finder: local module finder @5b4ec310 (roots: C:\Server\wildfly-8.0.0.Final\modules,C:\Server\wildfly-8.0.0.Final\modules\system\layers\base))

       

      Class loader for com.mypackage.MyWebServiceClient:

      ModuleClassLoader for Module "deployment.MyEar.ear.MyEjbJar.jar:main" from Service Module Loader

       

      I've played around with the jboss-deployment-structure.xml to prevent my deployed module from using the package javax/xml/ws from the jboss-jaxws-api_2.2_spec-2.0.2.Final.jar, but then other jars are missing. On the other side,

      it seems not possible to exclude the JDK class.

       

      The two classes are WildFly internals, so the server should handle this, or am I wrong?

       

      On JBoss AS 7.1.1 this problem does not show up.

       

      Thank you in advance for your efforts.

       

       

      I can't post an answer, because of a website error. So I have to do it here:

       

      I've cut the message off myself to simplify it. Here is the entire message:

       

      16:16:40,996 ERROR [stderr] (WebserviceConnection) Exception in thread "WebserviceConnection" java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, com/mypackage/MyWebServiceClient, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, javax/xml/ws/Service, have different Class objects for the type <init> used in the signature
      16:16:40,996 ERROR [stderr] (WebserviceConnection)  at com.mypackage.MyWebServiceClient.<init>(MyWebServiceClient.java:15)
      16:16:40,996 ERROR [stderr] (WebserviceConnection)  at com.mypackage.WebServiceConnector.connectToRegistry(WebServiceConnector.java:1106)
      16:16:40,996 ERROR [stderr] (WebserviceConnection)  at com.mypackage.WebServiceConnector.access$0(WebServiceConnector.java:1074)
      16:16:40,997 ERROR [stderr] (WebserviceConnection)  at com.mypackage.WebServiceConnector$1.run(WebServiceConnector.java:969)
      16:16:40,997 ERROR [stderr] (WebserviceConnection)  at java.lang.Thread.run(Thread.java:744)
      

       

      In the lib folder are only API jars of my own.