JavaBeat

  • Home
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Privacy
  • Contact Us

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

December 24, 2013 by Krishna Srinivasan Leave a Comment

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.

[code lang=”xml”]
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
[/code]

Exception Trace

[code]
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)
[/code]

Filed Under: Hibernate Tagged With: Hibernate 4 Tutorials

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.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Us

  • Facebook
  • Pinterest

As a participant in the Amazon Services LLC Associates Program, this site may earn from qualifying purchases. We may also earn commissions on purchases from other retail websites.

JavaBeat

FEATURED TUTORIALS

Answered: Using Java to Convert Int to String

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Copyright © by JavaBeat · All rights reserved