AbstractMethodError on entityManager.createQuery ()

Using GlassFish 4 The stack trace looks like this

Caused by: java.lang.AbstractMethodError
at com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:197)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:455)
at com.wellpoint.mobility.aggregation.core.configuration.impl.ConfigurationManagerImpl.loadConfiguration(ConfigurationManagerImpl.java:262)

      

Here are the sleeping jars that I think are related to this problem.

hibernate-commons-annotations-4.0.2.Final.jar
hibernate-core-4.2.15.Final.jar
hibernate-entitymanager.4.2.15.Final.jar
hibernate-jpa-2.0-api.1.0.1.Final.jar

      

As per another question I saw in this same exception, hibernate JPA 2.0 should work with hibernate versions> 3.5. Vague memories of math classes tell me 4.2.15> 3.5, so apparently I shouldn't have these issues. Any thoughts?

+3


source to share


1 answer


GlassFish 4 uses Java EE 7, so you should use JPA 2.1 instead of JPA 2.0.

According to the Hibernate docs, this is the compatibility pack:

  • JPA 1.0: ORM 3.2+

  • JPA 2.0: ORM 3.5+

  • JPA 2.1: ORM 4.3+



So, you should be using Hibernate 4.3 with JPA 2.1:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>4.3.7.Final</version>
</dependency>

<dependency>
    <groupId>org.hibernate.javax.persistence</groupId>
    <artifactId>hibernate-jpa-2.1-api</artifactId>
    <version>1.0.0.Final</version>
</dependency>

      

+1


source







All Articles