5 Replies Latest reply on Jan 13, 2017 3:11 PM by vmrnkv

    Issue in Eclipselink JPA support on wildfly 10.1

    samyomar82

      I have successfully ran eclipselink 2.6.2 on wildfly 10.0 But when I tried to migrate my application to wildfly 10.1 I got the following error.

       

      org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBException: java.lang.IllegalArgumentException: No [EntityType] was found for the key class in the Metamodel - please verify that the [Entity] class was referenced in persistence.xml using a specific com.unilever.replenishment.model.entities.ReplItem property or a global false element.

       

      My persistence unit looks like the following (which works on wildfly 10.0)

       

      <persistence-unit name="com.unilever_Replenishment_PU" transaction-type="JTA">
        
      <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        
      <jta-data-source>REPLENISHMENT_JNDI</jta-data-source>
        
      <exclude-unlisted-classes>false</exclude-unlisted-classes>
      </persistence-unit>

       

      I also posted this question on stackoverflow

       

      Any solution for this annoying issue ?  Is this a bug ?

        • 1. Re: Issue in Eclipselink JPA support on wildfly 10.1
          smarlow

          What happens if you add the class to the persistence.xml?

          class>com.unilever.replenishment.model.entities.ReplItem</class>

          • 2. Re: Issue in Eclipselink JPA support on wildfly 10.1
            vmrnkv

            Hi Scott, I have the same problem and using of class helps. But I have a lot of entities and in general I do not want to list all of them. Do you know how to solve the original issue?

            • 3. Re: Issue in Eclipselink JPA support on wildfly 10.1
              samyomar82

              I confirm that it works when I add

              class>com.unilever.replenishment.model.entities.ReplItem</class>

               

              in persistence unit, but its not a practical solution for a huge number of entity classes.

              Any solution or workaround ?

              • 4. Re: Issue in Eclipselink JPA support on wildfly 10.1
                smarlow

                Good to know that works around the failure.  That gives us a clue that EclipseLink cannot discover the entity classes for some reason.  I'm not sure why.

                 

                https://github.com/wildfly/wildfly/blob/master/testsuite/compat/src/test/java/org/jboss/as/test/compat/jpa/eclipselink/EclipseLinkSharedModuleProviderTestCase.java#L52 shows that we aren't using the "class" workaround in our (very simple) EclipseLink unit test that ensures that EclipseLink works at all with each release of WildFly.  The WildFly unit test is using EclipseLink version 2.6.3.  Which version of EclipseLink are you using?

                 

                It may be that you didn't set the EclipseLink system property ("eclipselink.archive.factory" value="org.jipijapa.eclipselink.JBossArchiveFactoryImpl") as mentioned here.

                • 5. Re: Issue in Eclipselink JPA support on wildfly 10.1
                  vmrnkv

                  Thank you, it works for me.

                   

                  As a result I have:

                  modules/system/layers/base/org/eclipse/persistence/main/module.xml

                  <module xmlns="urn:jboss:module:1.3" name="org.eclipse.persistence">
                      <properties>
                          <property name="jboss.api" value="private"/>
                      </properties>
                  
                      <resources>
                          <resource-root path="jipijapa-eclipselink-10.1.0.Final.jar"/>
                          <resource-root path="eclipselink-2.6.4.jar"/>
                          <filter>
                              <exclude path="javax/**" />
                          </filter>
                      </resources>
                  
                      <dependencies>
                          <module name="asm.asm"/>
                          <module name="javax.api"/>
                          <module name="javax.annotation.api"/>
                          <module name="javax.enterprise.api"/>
                          <module name="javax.persistence.api"/>
                          <module name="javax.transaction.api"/>
                          <module name="javax.validation.api"/>
                          <module name="javax.xml.bind.api"/>
                          <module name="org.antlr"/>
                          <module name="org.dom4j"/>
                          <module name="org.javassist"/>
                          <module name="org.jboss.as.jpa.spi"/>
                          <module name="org.jboss.logging"/>
                          <module name="org.jboss.vfs"/>
                      </dependencies>
                  </module>
                  

                  pom.xml in my project:

                  <dependency>
                      <groupId>org.eclipse.persistence</groupId>
                      <artifactId>eclipselink</artifactId>
                      <version>2.6.4</version>
                      <scope>provided</scope>
                  </dependency>
                  

                  standalone-full.xml

                      <system-properties>
                          <property name="eclipselink.archive.factory" value="org.jipijapa.eclipselink.JBossArchiveFactoryImpl"/>
                      </system-properties>