springhibernatejpajpa-2.0oc4j

javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode() Ljavax/persistence/SharedCacheMode;


I have persistence-api-1.0.2,hibernate-jpa-2.0-api-1.0.1.Final and other related jars in the lib directory. However, when I am deploying war file, I am getting the following error

nested exception is java.lang.NoSuchMethodError:
javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()
Ljavax/persistence/SharedCacheMode; 

How can I resolve this issue?

Update

Jars in lib folder

enter image description here


Solution

  • Why would you have JPA API 1.0 (which is what persistence-api-1.0.2 is) and JPA API 2.0 (hibernate-jpa-2.0-api) in the CLASSPATH at the same time?? Decide which version of JPA you are using before you do anything else