Signup/Sign In

[SOLVED] java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 11

Technology #Java

    If you are upgrading your Java application from a lower version to Java 11, you may get the following error:

    java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException

    The JAXB APIs are considered to be Java EE APIs, and therefore are no longer contained on the default class path in Java SE 9. In Java 11 they are completely removed from the JDK. If you are using Java 9, then the JAVA SE module named is in the classpath but this module doesn't contain the JAVA EE APIs. While from Java 11 onwards, the jaxb apis, namely:

    1. jaxb-api

    2. jaxb-core

    3. jaxb-impl

    4. activation, etc

    are completely removed from the Java installation. Hence, to resolve the above error, you must include the jaxb-api jar file in the classpath of your project/application.

    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.


    This will include the jaxb-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.bind', name: 'jaxb-api', version: '2.3.0'

    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.bind" % "jaxb-api" % "2.3.0"

    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.bind" name="jaxb-api" rev="2.3.0"/>

    If you don't use any build tool

    If you are not using any build tool, then you can download the jar file from the following link: JAXB-API 2.3.0 MVN Repository and add it to your project's classpath

    Once you have made the following changes, restart your Java application, and the error should be resolved. So this was the solution for the java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException Error. If you are not able to understand anything, feel free to comment, and we will help you resolve your error.


    To summarise, the "java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException" problem in Java 11 is irritating, but it is fixable. This error happens as a result of the loss of JAXB from Java 11, but it is fixable by adding the required dependencies to your project. You can effectively resolve this error and proceed with your Java 11 development tasks by following the methods outlined in this piece. Remember to maintain your files up to date to avoid making similar mistakes in the future.

    Frequently Asked Questions

    1. What is the cause of "java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException" in Java 11?

    Java 11 removed the JAXB (Java Architecture for XML Binding) module, causing this error when running code that depends on it.

    2. How can I resolve "java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException" in Java 11?

    You can resolve this error by adding the JAXB module to your project's dependencies. For example, if using Maven, add the following dependency to your pom.xml file:

        <!-- Other dependencies -->

    3. Can I still use JAXB in Java 11?

    You can still use JAXB in Java 11 by adding it as a separate module or dependency to your project.

    4. What are the alternatives to JAXB in Java 11?

    Alternatives to JAXB in Java 11 include using other XML binding frameworks such as Jackson or XMLBeans, or manually parsing XML using the built-in XML parsing capabilities of Java.

    5. What is the error in Javax XML bind?

    The error in Javax XML bind typically occurs when the JAXB library is not included in the classpath or when the version of the library is not compatible with the version of the Java runtime environment.

    You Might Also Like

    This is the official profile of the Studytonight content team.