NoClassDefFoundError: org / hibernate / annotations / general / reflection / Metadata

I have a 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 have a factory session and a data source configured in the hibernate.cfg.xml file, and when trying to create a 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 tried adding the hibernate-commons-annotion banner directly to my build path, as well as my WEB-INF / lib, but so far failed

This is configured in the same way and works properly in another application that I created that does not need to import the annotation bank. Any ideas?

+8
source share
1 answer

Apparently 3.3.0.ga was a "bug", I had to update the 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

+11
source

Source: https://habr.com/ru/post/975046/


All Articles