SEVERE: Error configuring application listener of class com.sun.xml.ws.transport.http. servlet.WSServletContextListener
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 ….
Above error came when i was trying to setup tomcat 6.x for my project work. The complete environment details are below:
1. Java 6
2. tomcat 6.0
As you can see that the problem is related with the WSServletContextListener Class which is supposed to be present in Java 6 as it supports JAX-WS 2.0.
It works well if you are using tomcat 5.x but not with tomcat 6.x. Lets discuss some class loader changes done in tomcat from version 5.x to 6.x and then we talk about this problem.
- shared/lib directory is removed from the structure. In tomcat 5.x this directory used to keep all jar files which can be shared among all web applications. This directory in turn used to be specified as value of shared.loader property in conf/catalina.properties.
From tomcat 6.x this directory is removed but the property shared.loader is still there and can be used for loading class from any location external to tomcat directory.
- 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).
So if you need to run web service on tomcat 6.x with Java 6, you need to endorse the new version jars of JAX-WS 2.1. You can download the latest version of JAX-WS from https://jax-ws.dev.java.net/
1. Copy jaxws-api.jar and jaxb-api.jar in /jre/lib/endorsed folder.
2. Place rest of the implementation jar file from JAX-WS’s lib directory in shared.loader path.
Another option which worked for me was that create endorsed folder inside CATALINA_HOME and place api jars there only. I think tomcat just take care of this some how.
After setting up my project using the solution above i had the curiosity about the endorsed feature of Java and tried to know more about it. There exists a Java Endorsed Standards Override Mechanism to update the version of a technology included in the platform to correspond to a later standalone version of that technology (Standalone Technologies).
Read more about it at http://java.sun.com/javase/6/docs/technotes/guides/standards/index.html
Java added implementation of JAX-WS 2.1 in its later updates to avoid the error above so if you are using Java 6 update 4(or older version ) you need the above solution else things will work fine for you.
Most Commented Posts
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Thank You.
This Post was very helful for me. Now all works fine