Jboss EAP 6.3部署错误:未找到oracle数据源

时间:2015-04-11 16:07:39

标签: java oracle jboss oracle11g

部署时出现此错误:

20:02:42,954 ERROR [org.jboss.as.server] (management-handler-thread - 1) JBAS015870: Deploy of deployment "jboss-employee-rooster-jsp.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"jboss-employee-rooster-jsp.war#primary\" is missing 
[jboss.naming.context.java.jboss.datasources.OracleDS]"]}

这是我在standalone.xml中的Oracle DS:

        <datasource jta="true" jndi-name="java:/OracleDS" pool-name="OracleDS">
            <connection-url>jdbc:oracle:thin:@localhost:1521:XE</connection-url>
            <driver>oracleDriver</driver>
            <security>
                <user-name>SYSTEM</user-name>
                <password>Seventy5</password>
            </security>
        </datasource>
        <drivers>
            <driver name="oracleDriver" module="com.oracle">
                <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
            </driver>
        </drivers>

的persistence.xml:

<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="primary">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:jboss/datasources/OracleDS</jta-data-source>
        <class>org.jboss.as.quickstarts.employeerooster.model.Member</class>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
            <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
        </properties>
   </persistence-unit>
</persistence>

出了什么问题?

1 个答案:

答案 0 :(得分:0)

因为尴尬,我只需要替换:

<datasource jta="true" jndi-name="java:/OracleDS" pool-name="OracleDS">

datasource jta="true" jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">