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.
Comments
[...] to Techie Gyan, the following is the problem: “The second change which tells about the cause of the error [...]
Hi,
I am working with Tomcat 6.0.29 and JDK 1.6.0_21 and am facing the same issue.
I did what was specified in your post but still I am getting the same exception.
This is my catalina entry for shared.loader:
shared.loader=${catalina.home}/endorsed,${catalina.home}/endorsed/*.jar
and I have an endorsed directory under catalina.home containing all the JAR files for JAXWS 2.1.5
I also have the jaxws-api.jar and jaxb-api.jar in my jre endorsed folder.
Do you have any idea why I might still be getting the below error:
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:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4078)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
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:445)
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(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Hmm it looks like your blog ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I too am an aspiring blog writer but I’m still new to the whole thing. Do you have any helpful hints for inexperienced blog writers? I’d genuinely appreciate it.

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