Search code examples
jpaeclipselinkwildfly-10

EclipseLink Configuration in Wildfly-10.1.0.Final not reflecting the PersistenceProvider


I am using EclipseLink as a JPA Implementation. While deploying in Wildfly-10.1.0.Final, I always get the error No Persistence provider for EntityManager named <the persistence unit name>. I have followed the step in the links:

  1. https://docs.jboss.org/author/display/WFLY10/JPA+Reference+Guide#JPAReferenceGuide-UsingEclipseLink

  2. https://developer.jboss.org/thread/273134

The steps and the module.xml exactly matches mine.In standalone.xml I have enabled the system property as stated in the first link mentioned above

I enabled the trace logging and found that the below : [org.hibernate.jpa.HibernatePersistenceProvider] (default task-4) Excluding from consideration due to name mis-match

Persistence Provider :org.eclipse.persistence.jpa.PersistenceProvider JDK Version :1.8

Request if someone can shed some light where I am going wrong.

Added the trace as

Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named AAAAA_BBBB
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)

Other trace of Mismatch

2017-02-23 17:47:09,276 DEBUG [org.hibernate.jpa.HibernatePersistenceProvider] (default task-55) Checking persistence-unit [name=AAAAA_BBBB, explicit-provider=org.eclipse.persistence.jpa.PersistenceProvider] against incoming persistence unit name [AAAAA_BBBB]
2017-02-23 17:47:09,276 DEBUG [org.hibernate.jpa.HibernatePersistenceProvider] (default task-56) Checking persistence-unit [name=AAAAA_BBBB, explicit-provider=org.eclipse.persistence.jpa.PersistenceProvider] against incoming persistence unit name [AAAAA_BBBB]
2017-02-23 17:47:09,277 DEBUG [org.hibernate.jpa.HibernatePersistenceProvider] (default task-56) Excluding from consideration due to name mis-match

Additional Traces

2017-02-24 05:32:49,031 TRACE [org.hibernate.jpa.boot.spi.ProviderChecker] (default task-7) Checking requested PersistenceProvider name [org.eclipse.persistence.jpa.PersistenceProvider] against Hibernate provider names 2017-02-24 05:32:49,031 DEBUG [org.hibernate.jpa.HibernatePersistenceProvider] (default task-11) Excluding from consideration due to provider mis-match 2017-02-24 05:32:49,031 TRACE [org.hibernate.jpa.boot.spi.ProviderChecker] (default task-7) Found no match against Hibernate provider names

The persistence.xml

<persistence-unit name="AAA_BBB" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>    
        <jta-data-source>java:/<jndi-Name in standalone</jta-data-source>
        <class>...</class>
        <properties>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
            <property name="javax.persistence.jdbc.url" value="<url>"/>
            <property name="javax.persistence.jdbc.user" value="<username>"/>
            <property name="javax.persistence.jdbc.password" value="<pwd>"/>
        </properties>
    </persistence-unit>
    <persistence-unit name="CCC_DDD" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>    
        <jta-data-source>java:/<jndi-Name in standalone</jta-data-source>       
        <class>...</class>
        <properties>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
            <property name="javax.persistence.jdbc.url" value="<url>"/>
            <property name="javax.persistence.jdbc.user" value="<username>"/>
            <property name="javax.persistence.jdbc.password" value="<pwd>"/>
        </properties>
    </persistence-unit>

Solution

  • Was finally able to resolve the issue in a little weird way (probably)

    Step 1 : created a module directory under the name (com.abc.persistence:main) Step 2 copied all the related jars of eclipselink and jipijapa into the same module and referred it.

    Step 2. Removed the system property "eclipselink.archive.factory"

    It works clean.

    What I analysed was if one of the system property is put then others like the target server are never added to the properties map (I checked somewhere in the code). Once I removed I think all the others also gets added and hence it works, because I will be little surprised if creating the above directory in the module (Step 1 above ) made it work.