java - Jadira 依赖导致 AbstractMethodError

标签 java spring hibernate maven jpa

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

这里是依赖:

<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 .

最佳答案

你所指的文章是这样说的

The code works with Spring Boot 1.2.2 and Hibernate 4.5

从您的日志看来,您正在使用 Spring Boot 1.4.2,它将获取 Hibernate 5 jar。 Hibernate 5 和旧版本的 jadira(您使用的是 3.1.0.CR1)存在一些问题。自 jadira 用户类型的 5.0.0.GA 版本以来,此问题已得到修复。你能试试新版本吗https://mvnrepository.com/artifact/org.jadira.usertype/usertype.core

关于java - Jadira 依赖导致 AbstractMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41359547/

相关文章:

java - 查找加权有向图中两个指定顶点之间是否存在任何路径

java - Foreach in foreach 从列表中删除项目

java - 配置 Intellij 的 "New Project"默认值以使用 Spring MVC 版本 5

java - org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes 阻塞线程

java - hibernate 不再工作......为什么?

Java ATM 程序

java - Kotlin/Java/JVM - 解析俄罗斯日期,如 "28 фев. 2019"

java - 如何从 json 发送 Java Long 值

java - -XX :MaxPermSize=128m: command not found when setting MaxPermSize on linux server

hibernate - 列类型错误 - 发现 : serial, 预期:int8