Define XA-Datasource on JBoss 7.1 with Oracle11g (tips, links, sample)

Share on:

This is a note to myself post, but I hope to help others currently trying to figure out how to properly get started with an XA-Datasource definition, for Oracle 10/11g and JBoss 7.1 Application Server.

I have made all the related resources link-able.

1. Make sure you have downloaded the correct JDBC drivers from Oracle. Here or here, depending on your installation for 11g. While reading the JBoss documentation you will notice some warning about the correctness of the jar driver, that has to include the appropriate manifest files so that the driver class can located and loaded properly. Eventually if you download the driver from the Oracle web site, the jar is created appropriately with no further change.

2. You have 2 main options for installing the driver in the new JBoss 7.1.x. You either drop it to the deployment folder so the app server would deploy, or you create a module and you modify accordingly the app server configuration. Both options are well documented on the official JBoss 7.1 developer guide and the Admin guide. There is also the CommandLine Interface tool, that can perform the same tasks, you may have a look here.

3. At the time being, I am going to use the profile called - standalone setup. (All the available configurations here)

4. My choice was to drop the ojdbc6.jar to the /standalone/deployments_ folder and upon starting the app server, I could see in the logs that the server picked the change up, and deployed the driver.

5.I have edited the JBOSS_HOME\standalone\configuration\standalone.xml and added the following section, under the element ** datasources**. Please watch out I am intentionally providing a very basic configuration on this post, with no further configuration on pools or datasource validation functionality. I leave it up to you, to fill any related parameters that fit to your needs and environment. You can find the snippet here as well.

  1. Upon restart you will notice that the Application server - is trying to initialize the Datasource. Another potential problem (that I had) is that the Oracle Schema/User that my Datasource was pointing to,did not have the appropriate rights to support transactions. So it is possible to have errors like the following, see here . A potential solution if indeed this is the simple case is to grant to your Oracle User the specific rights as documented here.(see Section 7.4.1.1)

That's all about it. The good thing with JBoss 7.X is that you many options to apply such configuration/setup changes. Either manually editing some specific config files, or through the Administration console, or using the command line interface tool, or the Maven JBoss Plugin ( link).

Happy JBoss-ing.