Caused by: java.lang.ClassNotFoundException: javax.xml.bind.Validation

Caused by: java.lang.ClassNotFoundException: javax.xml.bind.Validation

JAXB API是java EE 的API,因此在java SE 9.0 中不再包含这个 Jar 包。
java 9 中引入了模块的概念,默认情况下,Java SE中将不再包含java EE 的Jar包
而在 java 6/7 / 8 时关于这个API 都是捆绑在一起的

引入下面依赖即可

jaxb-api maven地址:http://mvnrepository.com/artifact/javax.xml.bind/jaxb-api

jaxb-impl maven地址:http://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl

jaxb-core maven地址:http://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-core

activation maven地址:http://mvnrepository.com/artifact/javax.activation/activation

<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>


posted @ 2018-04-14 14:18  newcaoguo  阅读(5050)  评论(1编辑  收藏  举报