Exception in thread “main” java.lang.NoClassDefFoundError: javax/persistence/EntityListeners

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:1355)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1826)

at com.saravanan.hibernate.test.HibernateBasicTestCase.main(HibernateBasicTestCase.java:31)

Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityListeners

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)

… 5 more

 

Solution:

 

Place the JPA jar file

 

For example: hibernate-jpa-2.0-api-1.0.0.Final.jar

Advertisements

2 Comments

  1. Ivan
    Posted March 6, 2012 at 8:19 am | Permalink | Reply

    Geezzz thanks alot.. that’s solved my problem

  2. Nazia
    Posted June 20, 2012 at 7:19 am | Permalink | Reply

    Hi I also faced same error . and added the jar file using add external jars . still facing same error …

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: