Ruhezustand-Fehler - Erste SessionFactory-Erstellung fehlgeschlagen

Ruhezustand-Fehler - Die erste SessionFactory-Erstellung ist fehlgeschlagen.java.lang.NoClassDefFoundError: org / hibernate / annotations / common / reflection / ReflectionManager

Dies wird durch das Fehlen der Anmerkungsbibliothek von Hibernate Commons verursacht.

Initial SessionFactory creation failed.java.lang.NoClassDefFoundError:
org/hibernate/annotations/common/reflection/ReflectionManager
Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.example.persistence.HibernateUtil.buildSessionFactory(HibernateUtil.java:19)
    at com.example.persistence.HibernateUtil.(HibernateUtil.java:8)
    at com.example.common.App.main(App.java:11)
Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager
    at com.example.persistence.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
    ... 2 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.ReflectionManager
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    ... 3 more

Lösung

Sie können die Bibliothek vonHibernate official website herunterladen

Or

Fügen Sie die Abhängigkeit in Mavens pom.xml hinzu

        
        hibernate-commons-annotations
        hibernate-commons-annotations
        3.0.0.GA
    

P.S You may need to include the JBoss repository in order to download the Hibernate common annotation library.


    
      JBoss repository
      http://repository.jboss.com/maven2/