*************************** 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:/C:/company/development/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar!/javax/persistence/spi/PersistenceUnitInfo.class jar:file:/C:/company/development/repository/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar!/javax/persistence/spi/PersistenceUnitInfo.class It was loaded from the following location: file:/C:/company/development/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
看到这个错误,一头雾水,这是什么错误,翻译一下:
*************************** 应用程序启动失败 *************************** 描述: 尝试调用一个不存在的方法。该尝试是在下列地点进行的: org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor.getValidationMode (PersistenceUnitInfoDescriptor.java: 88) 以下方法并不存在: javax.persistence.spi.PersistenceUnitInfo.getValidationMode () Ljavax /持久性/ ValidationMode; 方法的类javax.persistence.spi。PersistenceUnitInfo,可从以下位置: jar:文件:/ C: /公司/开发/仓库/ javax /持久性/ persistence api / 1.0 / persistence-api-1.0.jar ! / javax / / spi / PersistenceUnitInfo.class持久性 jar:文件:/ C: /公司/开发/仓库/雅加达/持久性/ jakarta.persistence-api / 2.2.3 / jakarta.persistence-api-2.2.3.jar ! / javax / / spi / PersistenceUnitInfo.class持久性 它是从以下位置加载的: 公司文件:C: / /开发/仓库/ javax /持久性/ persistence api / 1.0 / persistence-api-1.0.jar 行动: 纠正应用程序的类路径,使其包含javax.persistence.spi.PersistenceUnitInfo的单一兼容版本
这是什么意思,就是尝试调用一个包,发现这个包里边并没有找到我要想要使用的方法,这个位置是在哪里呢,在****地方
也就是说我原本想要调用的包不是这个,但是你却调用过去了
也就是说
这两个包是冲突的,当然你可能和我不一样,我是本地项目。
jpa pom依赖:
org.springframework.boot spring-boot-starter-data-jpa
mybatis依赖:
tk.mybatis mapper3.4.0
由于这两个pom依赖中:
jpa中包含:
jakarta.persistence jakarta.persistence-api2.2.3 compile
mybatis中包含:
javax.persistence persistence-api1.0
两个包冲突导致的
如何查找类似问题 idea本人工具是社区办的idea,所以没有自带的jar包排重工具,这点很苦恼
idea中添加了插件maven helper可以解决查看包冲突的问题,但是maven helper中只能查看当前级别的pom中的文件是否冲突,无法将嵌套多层的jar包找出来,这点和令人费解,可能插件的功能性不是很好;
于是我全局搜索 persistence-api 废了很大时间才找到冲突的位置,好工具的重要性啊,如果你要使用的是正版的idea就很快了,可以直接找到红色的冲突jar包,将其exclusion即可。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)