exception in thread "Main" java.lang.noclassdeffounderror: javax/persistence/ Entitylisteners At org.hibernate.cfg.annotations.reflection.jpametadataprovider.getdefaults ( jpametadataprovider.java:96) at Org.hibernate.annotations.common.reflection.java.JavaReflectionManager.getDefaults (Javareflectionmanager.java : 226) At org.hibernate.cfg.configuration.secondpasscompile (configuration.java:1385) at Org.hibernate.cfg.Configuration.buildSessionFactory (configuration.java:1856) At com.jxd.studenttest.main ( STUDENTTEST.JAVA:21) caused by: java.lang.classnotfoundexception: Javax.persistence.EntityListeners At java.net.urlclassloader$1.run (urlclassloader.java:202) at Java.security.AccessController.doPrivileged (Native method) At java.net.urlclassloader.findclass ( urlclassloader.java:190) At java.lang.classloader.loadclass (classloader.java:306) at sun.misc.Launcher $AppClassLoader. LoadClass (launcher.java:301)At java.lang.classloader.loadclass (classloader.java:247)
... 5 more
Cause of error: This is because Hibernate 3.6 relies on JPA, so a JPA jar package must be included in the class path. You can find one in the Hibernate solution: include the Hibernate-jpa-2.0-api-1.0.0.final.jar package in class path. The package can be found in the hibernate-distribution-3.6.0.final/lib/directory
Java.lang.ClassNotFoundException:javax.persistence.EntityListeners