سؤال

We're currently using openjpa 2.2.1 with Glassfish 3. Since we have to make changes to our infrastructure anyway, we're considering upgrading to Glassfish 4. Unfortunately, I can't get OpenJpa to work with it. Whenever I try to access a Entity I get AbstractMethodErrors

Caused by: java.lang.AbstractMethodError: org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(Ljavax/persistence/SynchronizationType;Ljava/util/Map;)Ljavax/persistence/EntityManager;

(that is if I enhance the classed during build time with the openjpa-maven-plugin). If I use dynamic enhancement, I can't even deploy the app.

If I switch the persistence provider to EclipseLink, it seems to work fine. Unfortunately changing the persistence provider is not really an option as we use some OpenJPA-Features.

I tried OpenJpa 2.2.2 as well with the same result. On Glassfish 3 the same thing runs just fine.

هل كانت مفيدة؟

المحلول

Given the error posted, it looks like Glassfish 4 is assuming the use of a JPA 2.1 provider (due to the use of the SynchronizationType parameter when creating the EM). OpenJPA does not support the JPA 2.1 specification (yet).

You will need to disable or remove the JPA 2.1 APIs from Glassfish 4 so that the JPA 2.0 APIs can be used (packaged with OpenJPA). I am not sure how easy or doable this disablement is with Glassfish.

This issue was just created as a JIRA to OpenJPA and referenced this stackoverflow post: https://issues.apache.org/jira/browse/OPENJPA-2471

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top