Correct the classpath of your application so that it contains a single, compatible version of javax.
原创
©著作权归作者所有:来自51CTO博客作者HezhezhiyuLe的原创作品,请联系作者获取转载授权,否则将追究法律责任
前言
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor.getValidationMode(PersistenceUnitInfoDescriptor.java:88)
The following method did not exist:
javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
The method's class, javax.persistence.spi.PersistenceUnitInfo, is available from the following locations:
jar:file:/E:/JAVA/yycg_repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar!/javax/persistence/spi/PersistenceUnitInfo.class
jar:file:/E:/JAVA/yycg_repository/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar!/javax/persistence/spi/PersistenceUnitInfo.class
The class hierarchy was loaded from the following locations:
javax.persistence.spi.PersistenceUnitInfo: file:/E:/JAVA/yycg_repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.persistence.spi.PersistenceUnitInfo
Process finished with exit code 1
问题
我引入了JPA的一个包 不引入它 启动没问题 引入就报错 但是我还要用到jpa
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
后来发现不是它的问题
看最后一句报错
Correct the classpath of your application so that it contains a single, compatible version of javax.persistence.spi.PersistenceUnitInfo
这个说的是jar冲突,那么解决思路就应该是javax.persistence.spi.PersistenceUnitInfo
直接百度 网上就有很多解决jar冲突的
然后就找到解决思路了:最后解决文章