Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade Glassfish v2 to JPA 2.0?

I'm trying to use Hibernate 3.5.5 with Spring HibernateJpaVendorAdapter on Glassfish V2 but I'm getting the following exception when the Spring context is initialised:

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

at org.hibernate.ejb.util.LogHelper.logPersistenceUnitInfo(LogHelper.java:39) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:517) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

The problem is that Glassfish V2 uses JPA1.0 which is loaded on the server classpath before hibernate-jpa-2.0-api-1.0.0.Final.jar which ships with Hibernate. JPA 1.0 doesn't have a getSharedCacheModel method in PersistenceUnitInfo but JPA 2.0 does.

Is there any way of upgrading Glassfish V2 to use JPA 2.0 (or any other solution to this problem)?

Cheers,

J

like image 369
Jay Shark Avatar asked Oct 01 '10 15:10

Jay Shark


1 Answers

You can try putting the JPA 2.0 jar in the /domain/lib/endorsed dir

like image 142
Bozho Avatar answered Oct 13 '22 06:10

Bozho