1
votes

I'm new to the JBoss application server and I tried to add a datasource for an Oracle db in JBoss EAP6.3. But I am getting the error below and seeing error while 'Testing a db connection in server'.

Please let me know if I have missed something.

Step 1-> Added below datasource in standalone.xml file Step 2-> Created a module.xml file and placed under \modules folder as com\oracle\main Here is my module.xml file

  <?xml version="1.0" encoding="UTF-8"?>
 <module xmlns="urn:jboss:module:1.1" name="com.oracle">
<resources>
 <resource-root path="ojdbc6.jar"/>
</resources>
   <dependencies>
 <module name="javax.api"/>
  <module name="javax.transaction.api"/>
  </dependencies>
 </module>

Step 3-> Copied a ojdbc6.jar file in the com\oracle\main location.

Step 4-> Started the server by standalone.bat file

<datasource jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">
                <connection-url>jdbc:oracle:thin:@localhost:1521:XS</connection-url>
                <driver>oracle</driver>
                <security>
                    <user-name>system</user-name>
                    <password>system</password>
                </security>
            </datasource>
            <drivers>
                <driver name="oracle" module="com.oracle">
                    <xa-datasource-class>oracle.jdbc.driver.OracleDriver</xa-datasource-class>
                </driver>
            </drivers>


Error on console:

  Unexpected HTTP response: 500

  Request
{
"address" => [
    ("subsystem" => "datasources"),
    ("data-source" => "OracleDS")
],
"operation" => "test-connection-in-pool"
 }

 Response

 Internal Server Error
{
"outcome" => "failed",
 "failure-description" => "JBAS010440: failed to invoke operation:        JBAS010447: Connection is not valid",
"rolled-back" => true

}

please help me out how to create a connection ,

Thanks in advance

1

1 Answers

0
votes

Place your ojdbc6.jar in $JBOSS_HOME/modules/system/layers/base/oracle/jdbc/main/ along with your module.xml.

The path where you have placed your ojdbc6.jar and module.xml is not correct.
It should be modules/system/layers/base/com/oracle/main

Also define the data-source definition like:-

<datasource jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">
                <connection-url>jdbc:oracle:thin:@localhost:1521:XS</connection-url>
                <driver-class>oracle.jdbc.OracleDriver</driver-class>
                <driver>oracle</driver>
                <security>
                    <user-name>system</user-name>
                    <password>system</password>
                </security>
            </datasource>
            <drivers>
                 <driver name="oracle" module="com.oracle"/>
                </driver>
            </drivers>