Search code examples
classpathjax-wsclassloaderjava-ee-6jboss7.x

Error listenerStart - JaxWS - JBoss as 7


I'm trying to migrate a Jax-WS based web service to JBoss as 7 but the application (deployed as a war) failes to start the listener on start-up.

ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-14) Error listenerStart
ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-14) Context [/abc] startup failed due to previous errors
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) MSC000001: Failed to start service jboss.web.deployment.default-host (...)

The error message references to failed due to previous errors however no errors are printed in the log. The application in question bundles jax-ws-rt like this:

    <dependency>
        <groupId>sun-jaxws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.1.7</version>
    </dependency>

If I change the scope of the jax-ws-rt to be provided this causes a nice ClassNotFound as expected.

WARN  [org.jboss.as.ee] (MSC service thread 1-13) JBAS011006: Not installing optional component com.sun.xml.ws.transport.http.servlet.WSServletContextListener due to exception: java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener (…)

The servlet is defined like this in the web.xml.

<listener>
    <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
    <description>JAX-WS endpoint for data service</description>
    <display-name>abc</display-name>
    <servlet-name>abc</servlet-name>
    <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>abc</servlet-name>
    <url-pattern>/services/abc</url-pattern>
</servlet-mapping>

I cant understand whats wrong. How do I solve this and get the application deployed?

Thoughts:

  1. Am I missing a dependency?
  2. Can I reconfigure the war to use Jboss internal JaxWS without major refactoring?
  3. If I cant use a jboss internal JaxWS version can I force Jboss to use a version of Jaxws that I bundle in the war? (If so, what dependencies do I need for JaxWs?)

Solution

  • with JBoss AS7 (Java EE6) you actually shouldn't need to put the WSServlet in the web.xml as the servlet-class. But instead you would have there the class name of the class annotated with @Webservice

    All you want to do is make sure that in you JBoss configuration (e.g. standalone.xml) you have extension for webservices enabled:

    <extensions>
       [...]
       <extension module="org.jboss.as.webservices"/>
    </extensions>