I have my java web service up and running, and I am deploying it to Tomcat. However, when Tomcat starts up, the deployment is failing with the following exception:
java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener
I am told that Tomcat should have everything it needs, but that is clearly referring to Tomcat 5 and not Tomcat 6.
According to Techie Gyan, the following is the problem:
“The second change which tells about the cause of the error above is that tomcat 6.0 supports JAX-WS 2.1 and not JAX-WS 2.0 and java 6 supports 2.0 only (till some version, now it started supporting the newer version as well).”
My approach to fixing the problem is different, but it works:
- Go to https://jax-ws.dev.java.net/
- Download the latest version (2.2 at the time of this writing)
- Unzip the file and place the jars in Tomcat’s lib directory
- Restart Tomcat
Now I have no issues accessing my web service from Tomcat.