[springboot]Error creating bean with name 'entityManagerFactory' defined in class path resource

问题:在Eclipse的springboot项目中,运行Application.java文件,出现错误

 

问题分析: 

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 @ 2021-04-23 19:59  Strugglinggirl  阅读(310)  评论(0编辑  收藏  举报