2 Replies Latest reply on Dec 26, 2009 3:53 PM by Robert Spielmann

    JBAS 4.2.3-JDK6, Mule, JAX-WS classloading trouble

    Robert Spielmann Newbie

      Hi all,

       

      I'm facing the following infrastructure:

       

      - JBoss 4.2.3 JDK6 package

      - JDK 1.6.0_12

      - An application that contains Mule 2.2.1 with the CXF transport 2.2.1

       

      The application is deployed as a WAR into a copy of the "default" configuration.

       

      First problem is that I get a ClassCastException about org.apache.cxf.jaxws.ServiceImpl not being castable to javax.xml.ws.spi.ServiceDelegate21. After some research, I found out that the jboss-jaxws* JARs deliver a JAXWS 2.0 implementation, whereas the application needs a JAXWS 2.1 implementation.

       

      Next step was to configure classloading for the WAR. I created a jboss-web.xml and set java2ClassLoadingCompliance to "true". This helps a little, the ClassCastException is gone. But what I get now is this:

       

      WSDLException: faultCode=INVALID_WSDL: Document style message parts must define an element name: {http://somehost/whatever.wsdl}Request (javax.wsdl.WSDLException)
        org.jboss.ws.tools.wsdl.WSDL11Reader:964 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/wsdl/WSDLException.html
      
      

       

      I tried to fix the WSDL which was not quite successful because it contains soap12 stuff which I couldn't simply replace. I was a little unsure about why WSDL11Reader would be used here, so I debugged the loaded classes and found out that I'm still getting the javax.xml.ws classes like Service, Provider etc. from the JBoss JARs. I tried using a META-INF/services/javax.xml.ws.spi.provider file that contains "org.apache.cxf.jaxws.spi.ProviderImpl" as its only line, but obviously this file is not read but instead the default file from a JBoss JAR is used when the Provider is loaded. Thus, I'm still getting classes from the JBoss JAXWS implementation, and so I'm running into trouble again.

       

      The application brings quite a lot of libraries, e.g. jaxws-api-2.1-1-osgi.jar, and it ran just fine on JBoss 4.0.4. If I delete the jboss-jaxws* JARs from $JBOSS_HOME/lib/endorsed, I can also run the application just fine, even without tuning the classloading options.

       

      I'm a little unsure what to do now - I see a couple of options:

       

      - Use the regular JBoss 4.2.3 package instead of JBoss 4.2.3-jdk6

      - Use a scoped classloader repository which I tried but didn't quite get to work

      - What else could I do?

       

      I don't think that it will be possible to rewrite the entire collection of services in order to become JAXWS-compliant

       

      Any hints?

        • 1. Re: JBAS 4.2.3-JDK6, Mule, JAX-WS classloading trouble
          jaikiran pai Master

          rspielmann wrote:

           


           

          Next step was to configure classloading for the WAR. I created a jboss-web.xml and set java2ClassLoadingCompliance to "true".

          Setting java2ClassLoadingCompliance to true will do a parent first loading. I think you would want the other way around. Try setting java2ClassLoadingCompliance to false, so that the classes are first looked for in the .war classloader instead of the parent.
          1 of 1 people found this helpful
          • 2. Re: JBAS 4.2.3-JDK6, Mule, JAX-WS classloading trouble
            Robert Spielmann Newbie
            You're right, I'm sorry. I've set it to false. But I actually still get JBoss classes (javax.xml.ws.Service etc.) instead of those from the JARs contained in my application. I would think that if the classes from the WAR are loaded first, jboss-jaxws*.jar should not be used any more. Am I getting something wrong or is it simply impossible to get around libs/classes residing in lib/endorsed?