java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener

Problem

Deploying a JAX-WS web service on Tomcat, hits following error message :


java.lang.ClassNotFoundException: 
	com.sun.xml.ws.transport.http.servlet.WSServletContextListener	

Solution

The JAX-WS dependency library “jaxws-rt.jar” is missing.

  1. Go here http://jax-ws.java.net/.
  2. Download JAX-WS RI distribution.
  3. Unzip it and copy “jaxws-rt.jar” to Tomcat library folder “{$TOMCAT}/lib“.
  4. Restart Tomcat.

Reference

  1. WSServletContextListener JavaDoc

13 comments on “java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener

  1. Hi ,

    I am getting following error while upgrading my webservice application built with gradle from jdk1.8 to OpenJDK 11.

    [ERROR ] WSSERVLET11: failed to parse runtime descriptor: java.lang.IllegalArgumentException: Argument(s) “type” can’t be null.
    Argument(s) “type” can’t be null.
    [ERROR ] SRVE0283E: Exception caught while initializing context: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.IllegalArgumentException: Argument(s) “type” can’t be null.
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:118)
    at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2447)
    at [internal classes]
    Caused by: java.lang.IllegalArgumentException: Argument(s) “type” can’t be null.
    at com.sun.xml.bind.api.TypeReference.(TypeReference.java:89)
    … 1 more

    Can someone please help on fix this issue ?

    Reply
  2. I am getting following error while upgrading my webservice application built with gradle from jdk1.8 to OpenJDK 11.
    [ERROR ] WSSERVLET11: failed to parse runtime descriptor: java.lang.IllegalArgumentException: Argument(s) “type” can’t be null. Argument(s) “type” can’t be null. [ERROR ] SRVE0283E: Exception caught while initializing context: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.IllegalArgumentException: Argument(s) “type” can’t be null. at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:118) at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2437) at [internal classes] Caused by: java.lang.IllegalArgumentException: Argument(s) “type” can’t be null. at com.sun.xml.bind.api.TypeReference.(TypeReference.java:89) … 1 more

    Any help to resolve this issue is appreciated

    Reply
    1. have you find any fix for this issue

      Reply
  3. Java.net is shut down. The links on this page no longer work.

    Reply
  4. Hi MKYong,
    Getting the below error even after adding the jaxws-rt.jar while starting the tomcat.

    Jun 20, 2013 1:07:57 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Error configuring application listener of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
    java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3915)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Jun 20, 2013 1:07:57 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Skipped installing application listeners due to previous error(s)
    Jun 20, 2013 1:07:57 PM org.apache.catalina.core.StandardContext start
    SEVERE: Error listenerStart
    Jun 20, 2013 1:07:57 PM org.apache.catalina.core.StandardContext start
    SEVERE: Context [/HelloWorld] startup failed due to previous errors

    Appreciate your help.
    Thanks in advance.
    Regards,
    Pallavi

    Reply
  5. Hi MKYong,
    Getting the below error even after adding the jaxws-rt.jar.

    SEVERE: Error configuring application listener of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
    java.lang.NoClassDefFoundError: com/sun/istack/localization/Localizable

    Tried adding the following jars, no luck –
    jaxb-impl-2.1.10.jar , com.springsource.com.sun.xml.bind-sources-2.2.0.jar

    Appreciate your help.
    Regards,
    PD

    Reply
    1. Hi PD,
      Please add jaxb-core.jar and ha-api.jar to server lib or project lib.
      I have downloaded jaxws-ri-2.2.8 and added following jars to my project lib folder
      1. gmbal-api-only.jar
      2. ha-api.jar
      3. jaxb-core.jar
      4. jaxb-impl.jar
      5. jaxws-api.jar
      6. jaxws-rt.jar
      7. management-api.jar
      8. policy.jar
      9. stax-ex.jar
      10. streambuffer.jar

      Hope it helps,

      Regards,
      kaushal

      Reply
      1. I have met the same problem, your answer can absolutely solve it, thank you very much!

        Reply
      2. Hi Kaushal,

        I tried your solution but it did not work.
        getting error- libosgi-resource-locator.jar (The system cannot find the file specified). Similarly many other jars is missing.

        Please help !

        Reply
    2. try to add jaxb-core istack found inside jaxb

      Reply

Leave a Comment

Your email address will not be published. Required fields are marked *