java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener

Problem:

03-May-2021 19:15:28.056 SEVERE [ajp-nio-9209-exec-4] org.apache.catalina.core.StandardContext.listenerStart 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

Cause : jaxws-rt.jar is either missing or has multiple versions.

Solution 1:

  If you don’t have this jar add it to tomcat/lib folder. 

Solution 2:

   For maven, you can add the dependency in your pom.xml. Make sure to pick a version that works for you.

<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>

Solution 3:

I had this jar in tomcat/lib folder and also in my war file. So the fix was to set the scope to provided in my maven pom.xml. This way the jar is not exported with the war file.

https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-rt

<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.