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

我在我的pom.xml中定义了依赖项

 org.hibernate hibernate-commons-annotations 3.3.0.ga  

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

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

 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 

我已经尝试在我的Build Path和我的WEB-INF / lib中直接添加hibernate-commons-annotion jar,但是还没有运气

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

显然3.3.0.ga是一个’错误’,不得不更新依赖使用3.2.0.Final

  org.hibernate hibernate-commons-annotations 3.2.0.Final  

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