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

mkyong

Founder of Mkyong.com, passionate Java and open-source technologies. If you enjoy my tutorials, consider making a donation to these charities.

13 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Sankar Vadivel
2 years ago

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 ?

Michal Vician
2 years ago

After Java 1.4, you might want to copy the XML parser dependencies to dedicated Tomcat/endorsed folder. More info: https://tomcat.apache.org/tomcat-8.5-doc/class-loader-howto.html#:~:text=your%20web%20application-,XML%20Parsers%20and%20Java,-Starting%20with%20Java

Satya
3 years ago

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

Sankar Vadivel
2 years ago
Reply to  Satya

have you find any fix for this issue

Tom Briscoe
9 years ago

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

Meastro
12 years ago

What is the solution for jboss 5?

Pallavi
12 years ago

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

Praveen Das
13 years ago

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

vivekd
3 years ago
Reply to  Praveen Das

try to add jaxb-core istack found inside jaxb

Kaushal
12 years ago
Reply to  Praveen Das

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

Smrita Garg
9 years ago
Reply to  Kaushal

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 !

Chen Mingze
12 years ago
Reply to  Kaushal

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

Priyanka
13 years ago

If i use jetty plugin & use it as my server, then how to do that ?