gpt4 book ai didi

java - NoClassDefFoundError : org/hibernate/annotations/common/reflection/MetadataProvider

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:13:05 25 4
gpt4 key购买 nike

我在 pom.xml 中定义了依赖

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>

我在 C:/User/.m2/repository/org/hibernate/hibernate-commons-annotations/3.3.0.ga 中有上面的 jar

我在 hibernate.cfg.xml 中配置了 session 工厂和数据源,并尝试在我的主要方法中构建配置:

Configuration configuration = new Configuration().configure();
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
SessionFactory sessionFactory = configuration.buildSessionFactory(builder.build());
Session session = sessionFactory.openSession();

我得到:

Exception in thread "main" java.lang.NoClassDefFoundError: 
org/hibernate/annotations/common/reflection/MetadataProvider

我已经尝试在我的构建路径以及我的 WEB-INF/lib 中直接添加 hibernate-commons-annotion jar,但还没有成功

这是以相同的方式设置并在我构建的另一个应用程序上正常运行,它不需要导入注释 jar。有什么想法吗?

最佳答案

显然 3.3.0.ga 是一个“错误”,必须更新依赖项才能使用 3.2.0.Final

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

来源:https://hibernate.atlassian.net/browse/ANN-711

关于java - NoClassDefFoundError : org/hibernate/annotations/common/reflection/MetadataProvider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25755760/

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