我在 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
我在 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();
I get:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/hibernate/annotations/common/reflection/MetadataProvider
我尝试将 hibernate-commons-annotion jar 直接添加到我的构建路径以及 WEB-INF/lib 中,但还没有运气
这是以相同的方式设置并在我构建的另一个应用程序上正常运行的,该应用程序不需要导入注释 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>
Source: https://hibernate.atlassian.net/browse/ANN-711
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)