2201_75283470 2024-07-29 16:14 采纳率: 0%
浏览 16

整合hibernate报错

整合kettle报错,引入hibernate在pom文件中
org.hibernate
hibernate-core
5.1.0.Final


hibernate-commons-annotations
org.hibernate.common


    <dependency>
        <groupId>org.hibernate.common</groupId>
        <artifactId>hibernate-commons-annotations</artifactId>
        <version>5.1.2.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${hibernate.version}</version>
        <exclusions>
            <exclusion>
                <artifactId>hibernate-commons-annotations</artifactId>
                <groupId>org.hibernate.common</groupId>
            </exclusion>
        </exclusions>
    </dependency>

报错Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [D:\tomcat\apache-tomcat-8.5.87\webapps\ROOT\WEB-INF\classes\applicationContext-dmserver.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.annotations.common.reflection.java.JavaReflectionManager.injectClassLoaderDelegate(Lorg/hibernate/annotations/common/reflection/ClassLoaderDelegate;)V,更该国5.2.X和5.1.x,

  • 写回答

1条回答 默认 最新

  • 张彦峰ZYF 优质创作者: Java技术领域 2024-08-03 17:46
    关注

    由于类路径中存在版本不兼容的问题,特别是涉及 Hibernate 和 Hibernate 相关的依赖项(如 hibernate-commons-annotations)时,这个问题常见。
    建议所有 Hibernate 依赖项版本一致,如 5.2.x。使用 dependency:tree 命令查看是否有冲突的依赖项,特别是不同版本的 hibernate-commons-annotations,需要排除一些不必要的依赖项,以避免版本冲突。

    评论

报告相同问题?

问题事件

  • 创建了问题 7月29日