Getting java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl despite the dependencies are defined

talha06 picture talha06 · Mar 5, 2018 · Viewed 18.6k times · Source

Despite that I have defined the related dependencies as I have added below, getting the java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl exception when my app makes a call to the web service.

<dependency>
  <groupId>javax.xml.ws</groupId>
  <artifactId>jaxws-api</artifactId>
  <version>2.2.10</version>
</dependency>

<dependency>
  <groupId>com.sun.xml.ws</groupId>
  <artifactId>jaxws-rt</artifactId>
  <version>2.2.10</version>
  <type>pom</type>
</dependency>

p.s. The servlet container is Apache Tomcat 9.0.4.

p.s. Java version: 9.0.1.

Answer

Nikolaos Georgiou picture Nikolaos Georgiou · Oct 5, 2018

The first part of the answer by @reta works for me. These are the relevant dependencies from my pom (Java 10):

<dependency>
  <groupId>javax.xml.ws</groupId>
  <artifactId>jaxws-api</artifactId>
  <version>2.3.1</version>
</dependency>
<dependency>
  <groupId>com.sun.xml.ws</groupId>
  <artifactId>rt</artifactId>
  <version>2.3.1</version>
</dependency>