Unable to define oracle datasource on Jboss AS 7
Asked Answered
W

5

5

I'm using Jboss AS 7.1.1.final and I'm trying to add an oracle Datasource:

<datasource jndi-name="java:jboss/datasources/DefaultDS" 
            pool-name="DefaultDS" 
            enabled="true" 
            use-java-context="true">
    <connection-url>jdbc:oracle:oci@TNS_NAME</connection-url>
    <driver>oracle</driver>
    <security>
        <user-name>username</user-name>
        <password>pwd</password>
    </security>
</datasource>

And the driver:

<driver name="oracle" module="com.oracle.ojdbc">
   <xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>
</driver>

But when I start the server I get:

JBAS014775:    New missing/unsatisfied dependencies:
  service jboss.jdbc-driver.oracle (missing) dependents: [service jboss.data-source.java:jboss/datasources/DefaultDS] 

I have a module under modules/com/oracle/ojdbc/main:

<module xmlns="urn:jboss:module:1.0" name="com.Oracle.ojdbc">
    <resources>
        <resource-root path="ojdbc6.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
    </dependencies>
</module>

and of course the jar is there.

Can someone please tell me what am I doing wrong here?

Woodberry answered 11/4, 2012 at 8:56 Comment(0)
W
4

Got the answer:

In the drivers section, I defined the driver as sitting in module "com.oracle.ojdbc" but the module itself is actually defined with capital 'O' in 'Oracle' so it should be "com.Oracle.ojdbc"

Woodberry answered 11/4, 2012 at 12:7 Comment(0)
K
7

Add this to define driver: for xa datasource

<driver name="oracleDriver" module="com.oracle.ojdbc">
         <driver-class>oracle.jdbc.OracleDriver</driver-class>
         <xa-datasource-class>oracle.jdbc.xa.OracleXADataSource</xa-datasource-class>
</driver>

for non-xa-------

<driver name="oracleDriver" module="com.oracle.ojdbc">
         <driver-class>oracle.jdbc.OracleDriver</driver-class>
    </driver>
Kersten answered 9/12, 2012 at 12:50 Comment(0)
W
4

Got the answer:

In the drivers section, I defined the driver as sitting in module "com.oracle.ojdbc" but the module itself is actually defined with capital 'O' in 'Oracle' so it should be "com.Oracle.ojdbc"

Woodberry answered 11/4, 2012 at 12:7 Comment(0)
K
1

Add this to define driver: for xa datasource

<driver name="oracleDriver" module="com.oracle.ojdbc">
         <driver-class>oracle.jdbc.OracleDriver</driver-class>
         <xa-datasource-class>oracle.jdbc.xa.OracleXADataSource

for non-xa-------

<driver name="oracleDriver" module="com.oracle.ojdbc">
         <driver-class>oracle.jdbc.OracleDriver</driver-class>
    </driver>
Kersten answered 12/6, 2015 at 7:29 Comment(0)
M
1

Path for the ojdbc jar in my case was : D:\ProgramFiles\JBoss6.4\modules\com\oracle\jdbc7\main where D:\ProgramFiles\JBoss6.4\ is the JBOSS HOME directory.

in the main folder, need to have following files.

ojdbc7.jar
module.xml

Entry for Module would look like below:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle.jdbc7">
<properties>
        <property name="jboss.api" value="unsupported"/>
    </properties>
 <resources>
 <resource-root path="ojdbc7.jar"/>
 </resources>
 <dependencies>
 <module name="javax.api"/>
 <module name="javax.transaction.api"/>
 <module name="javax.servlet.api" optional="true"/>
 </dependencies>
</module>
Manganate answered 22/4, 2018 at 3:18 Comment(0)
B
0

You can define datasource from admin interface, find good tutorial below

http://middlewaremagic.com/jboss/?p=350

Boron answered 23/9, 2013 at 12:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.