[Solved] Java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

1. Error code

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'entityManagerFactory' defined in class path resource 
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: 
Invocation of init method failed;
nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

2. Cause resolution

JAXB API is considered as Java EE API, so it is no longer included in the default classpath of Java se 9. In Java, 11 they are completely removed from the JDK.

<!--maven import-->
<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.3.0</version>
</dependency>

Similar Posts: