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

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
Tom Briscoe
Guest
Tom Briscoe

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

Meastro
Guest
Meastro

What is the solution for jboss 5?

Pallavi
Guest
Pallavi

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
Guest
Praveen Das

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

Kaushal
Guest
Kaushal

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

Chen Mingze
Guest
Chen Mingze

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

Smrita Garg
Guest
Smrita Garg

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 !

Priyanka
Guest
Priyanka

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

trackback
JAX-WS Tutorial

[…] in use: bindWrapper class package.jaxws.methodName is not found. Have you run APT to generate them?java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListenerjava.lang.ClassNotFoundException : […]