Quantcast
Channel: Coffeewithcode.com
Viewing all articles
Browse latest Browse all 40

Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: javax/persistence/EntityListeners

$
0
0

While working with hibernate  this error can be faced. This is because absence of ‘hibernate-jpa-2.0-api-x.x.x.Final.jar’ in your classpath.

  1. Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
  2. Exception in thread "main" java.lang.ExceptionInInitializerError
  3. at hibernate.HibernateUtil.buildSessionFactory(HibernateUtil.java:18)
  4. at hibernate.HibernateUtil.<clinit>(HibernateUtil.java:8)
  5. at driver.Driver.main(Driver.java:14)
  6. Caused by: java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
  7. at org.hibernate.cfg.annotations.reflection.JPAMetadataProvider.getDefaults(JPAMetadataProvider.java:96)
  8. at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.getDefaults(JavaReflectionManager.java:226)
  9. at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1385)
  10. at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1856)
  11. at hibernate.HibernateUtil.buildSessionFactory(HibernateUtil.java:15)
  12. ... 2 more
  13. Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityListeners
  14. at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  15. at java.security.AccessController.doPrivileged(Native Method)
  16. at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  17. at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  18. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  19. at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
  20. ... 7 more

What is Hibernate JPA?

The JPA 2.0 compatible Hibernate EntityManager is built on top of the core of Hibernate and Hibernate Annotations.This is the JAR containing the JPA 2.0 API, it provides all the interfaces and concrete classes that the specification defines as public API.

Click here to download and read more about hibernate JPA.

Your Suggestion Are Always Welcomed.


Viewing all articles
Browse latest Browse all 40

Trending Articles