2016-12-28 123 views
1

在尝试启动SpringApplication时,使用Maven添加Jadira依赖项会导致AbstractMethodError。在堆栈跟踪中没有任何帮助;它并没有引用我自己的任何类。什么导致这个错误,我该如何解决它?Jadira依赖项导致AbstractMethodError

这里的依赖性:

<dependency> 
    <groupId>org.jadira.usertype</groupId> 
    <artifactId>usertype.core</artifactId> 
    <version>3.1.0.CR1</version> 
</dependency> 

这里是堆栈跟踪的一部分:

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

AbstractMethodError会告诉你什么类的抽象方法是什么。 –

回答

4

你指的是文章说,

代码工作与Spring 1.2.2引导和Hibernate 4.5

从你的日志,它看起来像你使用Spring 1.4.2启动它将获取Hibernate 5个罐子。 Hibernate 5和旧版本jadira(您正在使用3.1.0.CR1)存在一些问题。从jadira usertype的5.0.0.GA版本开始,此问题已得到修复。你能否请用https://mvnrepository.com/artifact/org.jadira.usertype/usertype.core提供的新版本试用

+0

似乎也不适用于最新版本。 –

+0

你用5.0.0.GA版本试过了吗?你遇到了什么错误? – abaghel

+0

哦,看起来像5.0.0.GA的作品(最新版本不)。谢谢! –