NoClassDefoundError.:创建名为“Entity ManagerFactory”的bean时出错
也许您知道我应该将哪个依赖项包含到pom.xml中。Maven项目。以下是我的资料:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
UnsatisfiedDependencyException:创建类路径资源[org/SpringFramework/Boot/AutoConfigure/orm/jpa/HibernateJPAAutoConfiguration.class]中定义的名为“Entity ManagerFactory”的bean时出错:通过方法“Entity ManagerFactory”参数0表示的不满足的依赖关系;嵌套异常为org.springframework.beans.factory.unsatisfiedDependencyException:创建类路径资源[org/springframework/boot/autociguration/orm/jpa/hibernatejpaautociguration.class]中定义的名为“Entity ManagerFactoryBuilder”的bean时出错:通过方法“Entity ManagerFactoryBuilder”参数0表示的不满足的依赖关系;嵌套异常为org.springframework.beans.factory.beanCreationException:创建类路径资源[org/springframework/boot/autociguration/orm/jpa/hibernatejpaautociguration.class]中定义的名为'jpa vendoradapter‘的bean时出错:通过工厂方法实例化bean失败;嵌套异常为org.springframework.beans.beanInstantiationException:实例化[org.springframework.orm.jpa.jpavendoradapter]失败:工厂方法“jpa vendoradapter”引发异常;嵌套异常为java.lang.NoClassDefoundError:
hibernate-core
和hibernate-entitymanager
通过spring-boot-starter-data-jpa
可传递地包含
编辑:您是否可以首先尝试删除本地的.m2/repository
?有时它会被腐蚀。
rm-rf~/.m2/repository