Technology3 min read

[SOLVED] Caused by: java.lang.ClassNotFoundException: javax.xml.ws.WebServiceFeature in Java 11

Abhishek Ahlawat

By Abhishek Ahlawat โ€” Recently

Founder of StudyTonight and a MERN fullstack developer. Writes about JavaScript, web development, Linux, and tech.

Summarize this article using AI

For web applications created using JDK 1.8 or earlier version, migrating to the new versions of Java can be a pain because a lot of core changes have been introduced starting Java 9.

One such issue is ClassNotFoundException for JAXBException class [SOLVED] which is quite common and we have already covered its solution in one of our earlier post.

Once you have fixed the above issue by adding the jaxb-api, jaxb-impl, javax-activation-api and jaxb-core Jar files, there are chances that you must add one more JAR file which is specifically required for web applications.

So, if you see the following exception in the error logs,

Caused by: java.lang.ClassNotFoundException: javax.xml.ws.WebServiceFeature

You will have to add the jaxws-api JAR file to your project.

For Maven Projects:

If you are using Maven for handling dependencies in your Java project, you will have to add the following additional dependency in your pom.xml file.

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

This will include the jaxws-api Jar file in your project when you will build your maven java project.

For Gradle Projects:

If you use Gradle to build your project, then add the following line to your build.gradle file,

compile group: 'javax.xml.ws', name: 'jaxws-api', version: '2.3.1'

For SBT Projects:

If you use SBT build tool to compile and build your java project, then add the following line to your build file,

libraryDependencies += "javax.xml.ws" % "jaxws-api" % "2.3.1"

For IVY Projects:

If you use ivy for building your java project, then add the following code line to your ivy.xml file:

<dependency org="javax.xml.ws" name="jaxws-api" rev="2.3.1"/>

Hope this solution helps you solve your problem.

You may also like:

Spotted something outdated or wrong?

Liked this? See more StudyTonight posts in Google results.

Add StudyTonight as a preferred source
Next questLIVE OPSStep 2 / 3

Practice real incidents in the browser

System Design Ops โ€” put out fires, ship fixes, and stack XP. Reading done. Time to play.

Play System Design
  • +XP

    Every sim

  • Incidents

    Live ops

  • Ranks

    Climb up

Read next