Spring整合Hibernate时出现如下错误Caused by: java.lang.NoClassDefFoundError: javax/persistence/Entity

解决方法:加入Hibernate文件夹下的ejb3-persistence.jar

  在配置Hibernate时,出现如下错误

 

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

 错误在于javax.persistence.Cacheable是JPA2.0规范中的东西,需添加

hibernate-distribution-3.5.2-Final/lib/jpa/hibernate-jpa-2.0-api-1.0.0.Final.jar

http://xredman.javaeye.com/category/111815?show_full=true

 

 


hibernate-jpa-2.0-api-1.0.0.Final.jar与 ejb3-persistence.jar有很多重复的类,好像只用hibernate-jpa-2.0-api-1.0.0.Final.jar也可以

你可能感兴趣的:(Spring整合Hibernate时出现如下错误Caused by: java.lang.NoClassDefFoundError: javax/persistence/Entity)