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

Jacob picture Jacob · Dec 6, 2014 · Viewed 9.6k times · Source

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

Answer

Neil Stockton picture Neil Stockton · Dec 6, 2014

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