Hibernate Dependency Library Exception (JPA) : javax/persistence/SharedCacheMode

If you are developing hibernate application, you would encounter the following exception if you have not added the hibernate-jpa-2.1-api-1.0.0.Final.jar in your libraries. Lets see how you can get this JAR file.

<dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.0.Final</version>
</dependency>

Exception Trace

INFO: HHH000041: Configured SessionFactory: null
Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/SharedCacheMode
	at org.hibernate.metamodel.source.internal.MetadataBuilderImpl$OptionsImpl.<init>(MetadataBuilderImpl.java:131)
	at org.hibernate.metamodel.source.internal.MetadataBuilderImpl.<init>(MetadataBuilderImpl.java:88)
	at org.hibernate.metamodel.source.internal.MetadataBuilderImpl.<init>(MetadataBuilderImpl.java:55)
	at org.hibernate.metamodel.MetadataSources.<init>(MetadataSources.java:88)
	at org.hibernate.metamodel.MetadataSources.<init>(MetadataSources.java:79)
	at javabeat.net.hibernate.HibernateUtil.main(HibernateUtil.java:15)
Caused by: java.lang.ClassNotFoundException: javax.persistence.SharedCacheMode
	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)

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Speak Your Mind

*

Close
Please support the site
By clicking any of these buttons you help our site to get better