Wildfly-10.1.0.Final中的EclipseLink配置不反映PersistenceProvider

时间:2017-02-22 19:14:10

标签: jpa eclipselink wildfly-10

我使用EclipseLink作为JPA实现。在Wildfly-10.1.0.Final中部署时,我总是得到错误No Persistence provider for EntityManager named <the persistence unit name>。我已按照链接中的步骤进行操作:

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

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

  3. 这些步骤和module.xml完全匹配我的。在standalone.xml中,我已经启用了系统属性,如上面提到的第一个链接中所述

    我启用了跟踪日志记录,发现如下: [org.hibernate.jpa.HibernatePersistenceProvider](默认任务-4)因名称不匹配而排除考虑因素

    持久性提供者:org.eclipse.persistence.jpa.PersistenceProvider JDK版本:1.8

    要求有人可以在我出错的地方说清楚。

    添加了跟踪

    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)
    

    其他不匹配痕迹

    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
    

    其他痕迹

    2017-02-24 05:32:49,031 TRACE [org.hibernate.jpa.boot.spi.ProviderChecker](默认任务-7)针对Hibernate检查请求的PersistenceProvider名称[org.eclipse.persistence.jpa.PersistenceProvider]提供者名称 2017-02-24 05:32:49,031 DEBUG [org.hibernate.jpa.HibernatePersistenceProvider](默认任务-11)排除由于提供商不匹配导致的考虑因素 2017-02-24 05:32:49,031 TRACE [org.hibernate.jpa.boot.spi.ProviderChecker](默认任务-7)找不到与Hibernate提供者名称的匹配

    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>
    

1 个答案:

答案 0 :(得分:0)

终于能够以一种奇怪的方式解决问题(可能)

步骤1:在名称下创建模块目录(com.abc.persistence:main) 第2步将所有相关的eclipselink和jipijapa罐子复制到同一个模块中并引用它。

步骤2.删除系统属性&#34; eclipselink.archive.factory&#34;

干净利落。

我分析的是,如果其中一个系统属性被放置,那么其他类似目标服务器的东西永远不会被添加到属性映射中(我在代码中的某处检查过)。一旦我删除了,我认为其他所有其他内容也会被添加,因此它可以正常工作,因为如果在模块中创建上述目录(上面的步骤1)使其工作,我会感到很惊讶。