在尝试启动SpringApplication时,使用Maven添加Jadira依赖项会导致AbstractMethodError。堆栈跟踪没有任何帮助;它没有引用我自己的任何类。导致此错误的原因是什么?如何解决?
这是依赖:
<dependency>
<groupId>org.jadira.usertype</groupId>
<artifactId>usertype.core</artifactId>
<version>3.1.0.CR1</version>
</dependency>
这是stacktrace的一部分:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError
...
at sec.project.CyberSecurityBaseProjectApplication.main(CyberSecurityBaseProjectApplication.java:17) [classes/:na] // this is simply the line that launches the Spring app
...
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.4.2.RELEASE.jar:1.4.2.RELEASE]
Caused by: java.lang.AbstractMethodError: null
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:280) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
...
FWIW,我试图做this。
答案 0 :(得分:4)
您所指的文章说
该代码适用于Spring Boot 1.2.2和Hibernate 4.5
从您的日志中看起来您正在使用Spring Boot 1.4.2,它将获取Hibernate 5 jar。 Hibernate 5和旧版jadira
存在一些问题(您使用的是3.1.0.CR1)。自5.0.0.GA发布jadira usertype以来,此问题已得到修复。您能否尝试使用https://mvnrepository.com/artifact/org.jadira.usertype/usertype.core