[英]Error creating bean with Controller and entityManagerFactory
[英]Error creating a bean “entityManagerFactory”
我有一个使用JavaFX的Spring Boot项目。 当我运行该项目时,一切正常,但是使用Maven打包项目后,在尝试运行jar文件时出现此异常
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory'
Invocation of init method failed;nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
pom.xml是这个
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
尝试将以下依赖项添加到您的POM中:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</dependency>
也许您需要为软件包添加版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.