NoClassDefFoundError:org / hibernate / annotations / common / reflection / MetadataProvider [英] NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider
问题描述
我在我的pom.xml中定义了依赖关系。
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-commons-annotations< / artifactId>
< version> 3.3.0.ga< / version>
< /依赖关系>
我在 C:/User/.m2/repository/org/ hibernate / hibernate-commons-annotations / 3.3.0.ga
我在hibernate.cfg.xml中配置了会话工厂和数据源并尝试在我的主要方法中构建配置:
Configuration configuration = new Configuration()。configure();
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()。applySettings(configuration.getProperties());
SessionFactory sessionFactory = configuration.buildSessionFactory(builder.build());
Session session = sessionFactory.openSession();
我得到:
线程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
<依赖项>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-commons-annotations< / artifactId>
< version> 3.2.0.Final< / version>
< /依赖关系>
来源: https://hibernate.atlassian.net/browse/ANN-711
I have the dependency defined in my pom.xml
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
I have the above jar in C:/User/.m2/repository/org/hibernate/hibernate-commons-annotations/3.3.0.ga
I've got a session-factory and datasource configured in a hibernate.cfg.xml and while trying to build the configuration in my main method:
Configuration configuration = new Configuration().configure();
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
SessionFactory sessionFactory = configuration.buildSessionFactory(builder.build());
Session session = sessionFactory.openSession();
I get:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/hibernate/annotations/common/reflection/MetadataProvider
I've tried adding the hibernate-commons-annotion jar straight in my Build Path as well as my WEB-INF/lib, but no luck yet
This is setup the same way and running properly on another application I've built, which didn't need the annotations jar imported. Any ideas?
Apparently 3.3.0.ga was a 'mistake', had to update dependency to use 3.2.0.Final
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.2.0.Final</version>
</dependency>
Source: https://hibernate.atlassian.net/browse/ANN-711
这篇关于NoClassDefFoundError:org / hibernate / annotations / common / reflection / MetadataProvider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!