gpt4 book ai didi

java - 使用 hibernate 创建插入操作,我收到以下错误?

转载 作者:行者123 更新时间:2023-12-02 03:31:42 24 4
gpt4 key购买 nike

使用 hibernate 创建插入操作,出现以下错误线程异常

"main" java.lang.NoSuchMethodError: org.hibernate.cfg.annotations.reflection.XMLContext.<init>(Lorg/hibernate/boot/spi/ClassLoaderAccess;)V
at org.hibernate.cfg.annotations.reflection.JPAMetadataProvider.<init>(JPAMetadataProvider.java:66)
at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl.generateDefaultReflectionManager(MetadataBuilderImpl.java:742)
at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl.<init>(MetadataBuilderImpl.java:715)
at org.hibernate.boot.internal.MetadataBuilderImpl.<init>(MetadataBuilderImpl.java:127)
at org.hibernate.boot.MetadataSources.getMetadataBuilder(MetadataSources.java:135)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:654)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:723)
at com.pojoclass.main.InsertEmp.main(InsertEmp.java:20)

jar文件列表

C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\antlr-2.7.7.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\cdi-api-1.1-PFD.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\classmate-1.3.0.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\dom4j-1.6.1.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\el-api-2.2.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\geronimo-jta_1.1_spec-1.1.1.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\hibernate-annotations.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\hibernate-commons-annotations-5.0.1.Final.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\hibernate-core-5.2.0.Final.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\hibernate-jpa-2.1-api-1.0.0.Final.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\jandex-2.0.0.Final.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\javassist-3.20.0-GA.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\javax.inject-1.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\jboss-logging-3.3.0.Final.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\jsr250-api-1.0.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\mysql-connector-java-5.1.38-bin.jar
C:\Users\rbhupatiraju\Downloads\hibernate-release-5.2.0.Final\lib\required\hibernate-commons-annotations-3.0.0.ga.jar

最佳答案

您的类路径中存在不正确的库。

您不需要这个库

hibernate-release-5.2.0.Final\lib\required\hibernate-annotations.jar 

hibernate-release-5.2.0.Final\lib\required\hibernate-commons-annotations-3.0.0.ga.jar

我建议您使用 Maven 或 Gradle 构建。

关于java - 使用 hibernate 创建插入操作,我收到以下错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38007566/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com