Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0
    • Fix Version/s: None
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Windows 8.1
      Glassfish 4.0
      OpenJPA 2.2.2
      ClusterJPA

      Description

      I am trying to deploy Glassfish 4.0 and OpenJPAv2.2.2 to use MySQL ClusterJPA plugin. However Whenever I try to access and entity manager I receive the following error:

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

      I opened an issue on the OpenJPA forums where a user suggested that I have Glassfish implement the JPA 2.0 spec rather than JPA 2.1. I'm unsure how I would go about that. I can attach the full stracktrace if that would be helpful.

      Here is the link to the OpenJPA issue:

      https://issues.apache.org/jira/browse/OPENJPA-2471

        Activity

        Hide
        reza_rahman added a comment -

        Have you tried explicitly setting the JPA version via persistence.xml? Could you post your code?

        Show
        reza_rahman added a comment - Have you tried explicitly setting the JPA version via persistence.xml? Could you post your code?
        Hide
        jbreindel added a comment -

        Do I just change the version of the persistence.xml schema to change JPA versions? And Yes I can post some of my code soon when I return home.

        Show
        jbreindel added a comment - Do I just change the version of the persistence.xml schema to change JPA versions? And Yes I can post some of my code soon when I return home.
        Hide
        jbreindel added a comment -

        Here is the relevant stack trace:

        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.createNativeQuery(EntityManagerWrapper.java:567)

        I changed my persistence.xml file to use the JPA 2.0 schema as per a suggestion on the Glassfish forums. I am still confused though.

        <persistence xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
        version="2.0">
        <persistence-unit name="core" transaction-type="RESOURCE_LOCAL">
        <provider>
        org.apache.openjpa.persistence.PersistenceProviderImpl
        </provider>
        <class>...</class>
        <properties>
        <!-- <property name="openjpa.jdbc.SynchronizeMappings" value="add(ForeignKeys=true)"
        /> -->
        <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
        <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:5000/core" />
        <property name="openjpa.ConnectionUserName" value="***" />
        <property name="openjpa.ConnectionPassword" value="***" />
        <property name="openjpa.BrokerFactory" value="ndb" />
        <property name="openjpa.jdbc.DBDictionary" value="TableType=ndbcluster" />
        <property name="openjpa.ndb.connectString" value="localhost:1186" />
        <property name="openjpa.ndb.database" value="core" />
        <property name="openjpa.Log" value="DefaultLevel=INFO,SQL=TRACE" />
        </properties>
        </persistence-unit>
        </persistence>

        Show
        jbreindel added a comment - Here is the relevant stack trace: 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.createNativeQuery(EntityManagerWrapper.java:567) I changed my persistence.xml file to use the JPA 2.0 schema as per a suggestion on the Glassfish forums. I am still confused though. <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd " version="2.0"> <persistence-unit name="core" transaction-type="RESOURCE_LOCAL"> <provider> org.apache.openjpa.persistence.PersistenceProviderImpl </provider> <class>...</class> <properties> <!-- <property name="openjpa.jdbc.SynchronizeMappings" value="add(ForeignKeys=true)" /> --> <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" /> <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:5000/core" /> <property name="openjpa.ConnectionUserName" value="***" /> <property name="openjpa.ConnectionPassword" value="***" /> <property name="openjpa.BrokerFactory" value="ndb" /> <property name="openjpa.jdbc.DBDictionary" value="TableType=ndbcluster" /> <property name="openjpa.ndb.connectString" value="localhost:1186" /> <property name="openjpa.ndb.database" value="core" /> <property name="openjpa.Log" value="DefaultLevel=INFO,SQL=TRACE" /> </properties> </persistence-unit> </persistence>
        Hide
        jbreindel added a comment -

        It seems that Glassfish expects the JPA provider version to be 2.1. This doesn't allow for providers that are JPA 2.0 compliant.

        Show
        jbreindel added a comment - It seems that Glassfish expects the JPA provider version to be 2.1. This doesn't allow for providers that are JPA 2.0 compliant.

          People

          • Assignee:
            ethan.wang
            Reporter:
            jbreindel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: