WildFly为JNDI类型不匹配提供错误

时间:2016-08-26 07:24:24

标签: java hibernate jpa-2.0 jndi wildfly-10

我正在尝试在wildfly 10上查找我的数据源的jndi,但是它给出了类型不匹配错误。

Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'corePU' must be of type [javax.persistence.EntityManagerFactory], but was actually of type [org.jboss.as.connector.subsystems.datasources.WildFlyDataSource]"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host./MyDataSource"],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}

如何获取javax.persistence.EntityManagerFactory

类型的JNDI

我的persistence.xml是:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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">

<persistence-unit name="corePU" transaction-type="JTA">
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
    <jta-data-source>java:/MyDataSource</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <!--<shared-cache-mode>NONE</shared-cache-mode>-->
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
        <property name="hibernate.show_sql" value="false"/>
        <property name="hibernate.format_sql" value="false"/>
        <property name="hibernate.transaction.jta.platform" value="${jta.platform}"/>
        <property name="org.hibernate.envers.audit_table_prefix" value="z_"/>
        <property name="hibernate.cache.use_second_level_cache" value="false" />
        <property name="hibernate.generate_statistics" value="false"/>
        <property name="hibernate.cache.use_query_cache" value="false"/>
    </properties>
</persistence-unit>

0 个答案:

没有答案