java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

NO IMAGE

Spring Boot 2.0.0.M5 と Java 9 にて bootRun しようとすると、

Exception encountered during context initialization - cancelling refresh attempt: 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
...
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
...
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException

回避策の1つとしては、build.gradle の dependencies に

compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'

How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9
https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j

Javaカテゴリの最新記事