How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java

Опубликовано: 07 Октябрь 2024
на канале: java tmz
4,195
16

Hello in this video we will show you How to resolve No Class Def Found Error : javax xml bind JAXBException in Java 11 or java 12

I have some code that uses JAXB API classes which have been provided as a part of the JDK in Java 6 7 8. When I run the same code with Java 12, at runtime I get errors indicating that JAXB classes can not be found

so why can Java 11 no longer find these classes?

-

The JAXB APIs are considered to be Java EE APIs and therefore are no longer contained on the default classpath in Java SE 9. In Java 11, they are complete removed from the JDK.

Fortunately, these Java EE APIs that were provided in JDK 6/7/8 are still in the JDK, but they just aren't on the classpath by default.

So! wath is the Proper long-term solution:


What you will need to do in Java 11 and forward is include your own copy of the Java EE APIs on the classpath or module path. For example, you can add the JAX-B APIs as a Maven dependency