Error resolution: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/Datatype

Error details:

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ DatatypeConverter
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java: 1053 )
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java: 942 )
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java: 1005) 
    ……

the reason:

It is caused by the lack of jaxb-api package. In Java 8 and previous versions, the jar package jaxb is included by default; but in Java SE 9.0, this package is no longer included. If you use it, you need to import it manually.

JAXB API is the API of java EE, so this Jar package is no longer included in java SE 9.0.
The concept of modules was introduced in Java 9. By default, Java SE will no longer include the Jar package of Java EE, and this API will
be bundled together on Java 6/7/8 .

 

solve:

 

  1. Manually import the following packages:
    <!--Solve Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter-->
            <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>2.3.0</version>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
                <version>2.3.0</version>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-core</artifactId>
                <version>2.3.0</version>
            </dependency>
            <dependency>
                <groupId>javax.activation</groupId>
                <artifactId>activation</artifactId>
                <version>1.1.1</version>
            </dependency>


Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *