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:

       <xa-datasource-property name="URL">
       <xa-datasource-property name="User">bs01</xa-datasource-property>
       <xa-datasource-property name="Password">bs01</xa-datasource-property>
       <mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
       <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>

      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?


        • 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?