Proper definition of Oracle XA datasource in configuration
mjdinsmore Oct 4, 2011 12:39 PMI'm trying to make an XA datasource with Oracle in JBoss 7 (standalone-preview). I'm getting errors from this (I'll attach the relevant log file at the end of the post) -- saying it can't find the driver-name child.
From my understanding, I need to create the datasource definition in the standalone.xml (or standalone-preview.xml) file. I first created the Oracle module:
1. In /modules/com/oracle directory I put the ojdbc6.jar file and created a new file called modules.xml that reads:
<module xmlns="urn:jboss:module:1.0" name="com.oracle.db">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
2. In my standalone-preview.xml I added the following section to the xml file (replacing the sample h2 datasource that was there):
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<xa-datasource jndi-name="ds/MYDATASOURCE" pool-name="ds/MYDATASOURCE"
enabled="true" jta="true" use-java-context="true" use-ccm="true">
<xa-datasource-property name="URL">jdbc:oracle:thin:@MYSERVER.DOMAIN.COM:1521:MYSCHEMA
</xa-datasource-property>
<xa-datasource-property name="User">USERNAME</xa-datasource-property>
<xa-datasource-property name="Password">PASSWORD</xa-datasource-property>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-pool>
<is-same-rm-override>false</is-same-rm-override>
<no-tx-separate-pools />
</xa-pool>
<validation>
<valid-connection-checker
class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"></valid-connection-checker>
<stale-connection-checker
class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"></stale-connection-checker>
<exception-sorter
class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"></exception-sorter>
</validation>
</xa-datasource>
<drivers>
<driver name="ojdbc6.jar" module="com.oracle">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
I have tried finding an example of an XA datasource for the new JBoss 7 but unable to find one. I did find some documentation in the IronJacamar web page (http://docs.jboss.org/ironjacamar/userguide/1.0/en-US/html_single/#ex_datasources_oracle_xa) but that seems out of date and incorrect. It references a note saying to change "pad-true" in transaction.xml but no file of that name exists in JBoss 7. It also has a reference to <no-tx-separate-pools /> which is incompatible with the XSD when I had it in there -- so I basically don't think I can trust that documentation.
Here's the log file output I get. It makes it appear as though it's a problem with the xa-datasource xml fragment, not fro mthe driver fragment in my definition:
12:32:13,311 INFO [org.jboss.modules] JBoss Modules version 1.0.1.GA
12:32:13,467 INFO [org.jboss.msc] JBoss MSC version 1.0.0.GA
12:32:13,506 INFO [org.jboss.as] JBoss AS 7.0.1.Final "Zap" starting
12:32:14,132 WARN [org.jboss.as] No security realm defined for native management service, all access will be unrestricted.
12:32:14,186 INFO [org.jboss.as] creating http management service using network interface (management) port (9990)
12:32:14,188 WARN [org.jboss.as] No security realm defined for http management service, all access will be unrestricted.
12:32:14,197 INFO [org.jboss.as.logging] Removing bootstrap log handlers
12:32:14,203 ERROR [org.jboss.as.controller] (Controller Boot Thread) Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("xa-data-source" => "ds/GAPCore")
]): java.util.NoSuchElementException: No child 'driver-name' exists
at org.jboss.dmr.ModelValue.requireChild(ModelValue.java:362)
at org.jboss.dmr.ObjectModelValue.requireChild(ObjectModelValue.java:298)
at org.jboss.dmr.ModelNode.require(ModelNode.java:703)
at org.jboss.as.connector.subsystems.datasources.AbstractDataSourceAdd.performRuntime(AbstractDataSourceAdd.java:87)
at org.jboss.as.controller.AbstractAddStepHandler$1.execute(AbstractAddStepHandler.java:50)
at org.jboss.as.controller.OperationContextImpl.executeStep(OperationContextImpl.java:351)
at org.jboss.as.controller.OperationContextImpl.doCompleteStep(OperationContextImpl.java:298)
Any help or pointers to documentation would be much appreciated.
thanks,
Mike