springboot微服务运行出现java.lang.ClassNotFoundException: javax.xml.bind.JAXBException,缺少相关的jar包。
解决:
1.可以pom中引入相关的核心jar包,
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
问题如果还没有解决,可以引入更多的javax相关jar包:
javax.activation-1.2.0.jar
http://search.maven.org/remotecontent?filepath=com/sun/activation/javax.activation/1.2.0/javax.activation-1.2.0.jar
jaxb-api-2.3.0.jar
http://search.maven.org/remotecontent?filepath=javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
jaxb-core-2.3.0.jar
http://search.maven.org/remotecontent?filepath=com/sun/xml/bind/jaxb-core/2.3.0/jaxb-core-2.3.0.jar
jaxb-impl-2.3.0.jar
http://search.maven.org/remotecontent?filepath=com/sun/xml/bind/jaxb-impl/2.3.0/jaxb-impl-2.3.0.jar
2.如果你的java版本较高也会出现这种情况,在 java 6/7/8时关于这个API 都是捆绑,更高版本的脱离了。
解决方案:可以降低JDK版本到 JDK 6/7/8。