ClassNotFoundException common reflection ReflectionManager
Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.ReflectionManager
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager Exception in thread "main" java.lang.ExceptionInInitializerError at com.javahonk.HibernateUtil.buildSessionFactory(HibernateUtil.java:15) at com.javahonk.HibernateUtil.<clinit>(HibernateUtil.java:8) at com.javahonk.HibernateAnnotationTest.main(HibernateAnnotationTest.java:14) Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager at com.javahonk.HibernateUtil.buildSessionFactory(HibernateUtil.java:12) ... 2 more Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.ReflectionManager at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 3 more
Solution: If you see above exception it means hibernate-commons-annotations.jar is missing from your class path. For maven project please add below dependency:
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>3.0.0.ga</version> </dependency>
You could also check latest version on maven site here
- If you are using eclipse project then add hibernate-commons-annotations.jar in your class path.