我正在批处理,我遇到了一个问题.我已经确定了我的问题的原因,但我无法解决它.
一旦我在我的pom中添加依赖项,我就会开始出错
maven依赖是
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我的pom如下所示
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.edf.fr.batch</groupId>
<artifactId>edf-batch</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
我得到的错误是这个
java.lang.NoClassDefFoundError:org.springframework.data.jpa.util.BeanDefinitionUtils中的javax/persistence/EntityManagerFactory.(BeanDefinitionUtils.java:53)〜[spring-data-jpa-1.11.6.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.EntityManagerBeanDefinitionRegistrarPostProcessor.postProcessBeanFactory(EntityManagerBeanDefinitionRegistrarPostProcessor.java:54)〜[spring-data-jpa-1.11.6.RELEASE.jar:na] at org.springframework.context.support.PostProcessorRegistrationDelegate .invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:281)〜[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE] org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:176)〜[ spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)~ [spring-context-4.3.10.RELEASE.jar :4.3.10.RELEASE]在org.springframework.boot上的org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)〜[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]. SpringApplication.refresh(SpringApplication.java:693)[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]在org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)[spring-boot -1.5.6.RELEASE.jar:1.5.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE在org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] org.springframework.boot.SpringApplication.run(SpringApplication. java:1107)[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] at com.edf.fr.batch.MarcheBatchApplication.main(MarcheBatchApplication.java:10)[classes /:na]引起的:java.lang.ClassNotFoundException:java.ne中的javax.persistence.EntityManagerFactory t.URLClassLoader.findClass(URLClassLoader.java:381)〜[na:1.8.0_60] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)〜[na:1.8.0_60] at sun.misc.Launcher …