2 Replies Latest reply on Apr 5, 2010 8:49 AM by Laurens Winkelhagen

    JBoss 5.1: deploying a webservice in the web configuration

    Laurens Winkelhagen Newbie

      Dear all,

       

      I've been asked to deploy a java program (with a JAX-WS webservice) on JBoss and I'm running into some problems because of some restrictions placed upon this deployment.

       

      • I cannot alter the java code, just the configuration (*.xml and *.jar in the webapp directory tree) and deployment parameters.
      • I must use the JBoss 5.1 web configuration. Also, the application should run under an arbitrary Application server or indeed even under tomcat and jetty in principle.

       

      The application was originally build to run under glassfish 2.1 and deploying it under JBoss web configuration yielded an almost working application (except 'ofcourse' the webservice). Since then I've added jaxws-rt 2.1.3 to my pom.xml with effectively added most webservice-related libraries I needed to my /WEB-INF/lib directory in my .war.

      code:

      <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.1.3</version>
      </dependency>

       

      Also I had to include a jboss-classloading.xml to my war-file because of some issues I had with jaxp.

       

      <?xml version="1.0" encoding="UTF-8"?>

        <classloading xmlns="urn:jboss:classloading:1.0" name="myApplication"

             domain="myApplication" import-all="false">

      </classloading>

       

       

      Now the deployment works fine under jetty. It works fine under JBoss 5.1 default configuration and it even works fine when I use the web-configuration but do not use the -Djava.endorsed.dirs parameter. However when I use the web-configuration with the endorsed dirs, I get the following stacktrace:

       

      Caused by: java.lang.ExceptionInInitializerError

           at com.sun.xml.ws.api.BindingID.<clinit>(BindingID.java:318)
           at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.createBinding(DeploymentDescriptorParser.java:302)
           at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:243)
           at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)
           at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:108)
           ... 69 more
          Caused by: java.lang.IllegalStateException: Failed to load javax.xml.soap.MetaFactory: org.jboss.ws.core.soap.SAAJMetaFactoryImpl
           at javax.xml.soap.SAAJFactoryLoader.loadFactory(SAAJFactoryLoader.java:128)
           at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:58)
           at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:105)
           at com.sun.xml.ws.api.SOAPVersion.<init>(SOAPVersion.java:178)
           at com.sun.xml.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:83)
           ... 74 more
          Caused by: java.lang.ClassNotFoundException: org.jboss.ws.core.soap.SAAJMetaFactoryImpl
           at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
           at java.security.AccessController.doPrivileged(Native Method)
           at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
           at javax.xml.soap.SAAJFactoryLoader.loadFactory(SAAJFactoryLoader.java:122)
           ... 78 more
      

       

      As you can see, the application, guided by the lib/endorsed/jbossws-native-saaj.jar - /META-INF/services/javax.xml.soap.MetaFactory file, tries to load the 'org.jboss.ws.core.soap.SAAJMetaFactoryImpl' implementation of the javax.xml.soap.MetaFactory, but it cannot find this class (presumably because it is not available in the web configuration.

       

       

       

      Now I have the following questions:

      1. How do the libs in lib/endorsed behave with respect to classloading and Where can I find more information
      2. How hard should I try to convince my sysadmin to use the default jboss configuration
      3. Assuming I should be able to run a jax-ws webservice in the web configuration without altering the default start-up parameters, how do I do that?

       

      Thanks you all for your time,

      Kind Regards, Laurens Winkelhagen.

        • 1. Re: JBoss 5.1: deploying a webservice in the web configuration
          jaikiran pai Master

          Laurens Winkelhagen wrote:

           

          It works fine under JBoss 5.1 default configuration and it even works fine when I use the web-configuration but do not use the -Djava.endorsed.dirs parameter. However when I use the web-configuration with the endorsed dirs, I get the following stacktrace:

           

          Caused by: java.lang.ExceptionInInitializerError

               at com.sun.xml.ws.api.BindingID.<clinit>(BindingID.java:318)
               at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.createBinding(DeploymentDescriptorParser.java:302)
               at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:243)
               at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)
               at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:108)
               ... 69 more
              Caused by: java.lang.IllegalStateException: Failed to load javax.xml.soap.MetaFactory: org.jboss.ws.core.soap.SAAJMetaFactoryImpl
               at javax.xml.soap.SAAJFactoryLoader.loadFactory(SAAJFactoryLoader.java:128)
               at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:58)
               at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:105)
               at com.sun.xml.ws.api.SOAPVersion.<init>(SOAPVersion.java:178)
               at com.sun.xml.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:83)
               ... 74 more
              Caused by: java.lang.ClassNotFoundException: org.jboss.ws.core.soap.SAAJMetaFactoryImpl
               at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
               at java.security.AccessController.doPrivileged(Native Method)
               at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
               at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
               at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
               at javax.xml.soap.SAAJFactoryLoader.loadFactory(SAAJFactoryLoader.java:122)
               ... 78 more
          

           


          Why are you changing the endorsed dir property? Are you adding anything new to that property? JBoss AS expects that the JBOSS_HOME/lib/endorsed folder should be available as one of the endorsed directory.

          • 2. Re: JBoss 5.1: deploying a webservice in the web configuration
            Laurens Winkelhagen Newbie

            jaikiran pai wrote:

             

            Laurens Winkelhagen wrote:

             

            It works fine under JBoss 5.1 default configuration and it even works fine when I use the web-configuration but do not use the -Djava.endorsed.dirs parameter. However when I use the web-configuration with the endorsed dirs, I get the following stacktrace:

             

            Caused by: java.lang.ExceptionInInitializerError

              ....

            Why are you changing the endorsed dir property? Are you adding anything new to that property? JBoss AS expects that the JBOSS_HOME/lib/endorsed folder should be available as one of the endorsed directory.

             

            Dear Jaikiran,

             

            When I use the default java.endorsed.dirs property, I get the above stacktrace: In that endorsed dir is a jar file that has the /META-INF/services/javax.xml.soap.MetaFactory file which points to org.jboss.ws.core.soap.SAAJMetaFactoryImpl that cannot be found in the web-configuration.

             

            When I remove -Djava.endorsed.dirs from the start-up script everything works fine. That is what puzzles me.

             

            --Laurens