2 Replies Latest reply on Dec 4, 2006 9:27 AM by Paul Kaiser

    Not getting XADataSource

    Paul Kaiser Newbie

      I'm using JBoss 4.0.5.GA with Oracle 10g. I created a datasource definition in server/default/deploy/oracle-xa-ds.xml as follows:

      <datasources>
       <xa-datasource>
       <jndi-name>BasicService01DS</jndi-name>
       <track-connection-by-tx>true</track-connection-by-tx>
       <no-tx-separate-pools>true</no-tx-separate-pools>
       <isSameRM-override-value>false</isSameRM-override-value>
       <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
       <xa-datasource-property name="URL">
       jdbc:oracle:thin:@weezer:1521:demo1
       </xa-datasource-property>
       <xa-datasource-property name="User">bs01</xa-datasource-property>
       <xa-datasource-property name="Password">bs01</xa-datasource-property>
       <exception-sorter-class-name>
       org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
       </exception-sorter-class-name>
       </xa-datasource>
      
       <mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
       name="jboss.jca:service=OracleXAExceptionFormatter">
       <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
       </mbean>
      </datasources>


      When I look at it in the JXM console, it shows

      +- BasicService01DS (class: javax.sql.DataSource)
      


      When I try to get a transactional connection using JBoss Transactions' TransactionalDriver

      Connection conn = arjunaJDBC2Driver.connect("jdbc:arjuna:java:BasicService01DS", new Properties());


      it throws a ClassCastException

      14:20:27,308 ERROR [STDERR] java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrapperDataSource


      For some reason the datasource definition above is not realizing an XA datasource. Does this indicate that the Oracle database is not configured to support XA (I'm checking into this now) or is it some other configuration I've neglected to perform in JBoss?

      Thanks,
      Paul


        • 1. Re: Not getting XADataSource
          Weston M. Price Master

          You don't need to use the Arjuna Transactional Driver. This is the point of JCA, we do this for you.

          Your lookup would be:

          
          InitialContext ctx = new InitialContext();
          DataSource ds = (DataSource)ctx.lookup("java:/BasicService01DS");
          Connection conn = ds.getConnection()
          
          


          JCA handles transaction enlistment for you so there is no need for a special wrapper in this case.



          • 2. Re: Not getting XADataSource
            Paul Kaiser Newbie

            Thanks. I'm not as knowledgeable on JCA as I should, I guess. A quick follow up on scope. Over what boundaries will JCA's transaction enlistment traverse? Will it enlist any XA data source used in the same thread? Across contexts? Across JVMs?

            Thanks,
            Paul