java.lang.NoClassDefFoundError: javax/persistence/Cacheable (Hibernate 3.5)

When developing applications using Hibernate 3.5, we may encounter the following exception "java.lang.NoClassDefFoundError: javax/persistence/Cacheable"

Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/Cacheable
    at org.hibernate.cfg.AnnotationBinder.determineCacheSettings(AnnotationBinder.java:953)
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:596)
    at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
    at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
    at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:838)
    at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:128)
    at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91)
    at com.hibernate.test1.Test.main(Test.java:16)
Caused by: java.lang.ClassNotFoundException: javax.persistence.Cacheable
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
Possible Solutions

Check if your classpath has all the libraries. This error may get solved by including hibernate-jpa-2.0-api-1.0.0. in your classpath which can be found at hibernate-distribution-3.5.3-Final\lib\jpa.

 
 
 
 
Comments(0) Sign in (optional)
 
Add a new comment...  (Use Discussion Board for posting new aptitude questions.)

Name:
Email: (optional)
0 + 1 = (please answer the simple math question)

Post Your Comment
X  
View & Edit Profile Sign out
X
Sign in
Google
Facebook
Twitter
Yahoo
LinkedIn
X