我有一个使用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>
答案 0 :(得分:2)
尝试将这些依赖项添加到您的POM中:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</dependency>
也许您需要为软件包添加版本。