2 Replies Latest reply on Jul 17, 2003 5:24 AM by s_thom

    Oracle XA

    s_thom

      I am using the following datasource defn - found in the examples

      <xa-datasource>
      <jndi-name>OracleXADS</jndi-name>
      <track-connection-by-tx>true</track-connection-by-tx>
      <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:oci8:@EUSLND01</xa-datasource-property>
      <xa-datasource-property name="User">leatda</xa-datasource-property>
      <xa-datasource-property name="Password">leatda</xa-datasource-property>
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      </xa-datasource>


      If I do the following lookup

      InitialContext ctx = new InitialContext();
      XADataSource xads = (XADataSource)ctx.lookup("java:/OracleXADS");

      should I expect to see an XADataSource object? I get a classcast exception. I have to treat it as a DataSource object. But if I do that and then try to call

      ds.getConnect();

      I get the following exception

      15:08:47,831 ERROR [MessageDrivenTxInterceptorBMT] Application error: BMT stateless bean ts/Test3MDB should complete transactions before returning (ejb1.1 spec, 11.6.1)


      Here is a snippit of the code (It's within an MDB and I am using bean managed transaction)

      public void onMessage(Message message) {


      UserTransaction ut = null;
      boolean doneEnd = false;

      try {

      ut = ctx.getUserTransaction();
      ut.begin();

      TextMessage tm = (TextMessage)message;

      / (**) After this exception is thrown
      Connection c = dataSource.getConnection();

      if ( tm.getText().startsWith("ROLLBACK:") ) {
      System.out.println("About to rollback transaction");
      ut.rollback();
      doneEnd = true;
      } else {
      System.out.println("About to commit transaction");
      ut.commit();
      doneEnd = true;
      }
      } catch ( Exception e ) {
      e.printStackTrace();
      try {
      if ( ut != null && !doneEnd )
      ut.rollback();
      } catch ( Exception ee ) {
      ee.printStackTrace();
      }
      }
      ...


      After the (**) getConnection I get the above exception.

      Any one got any ideas?

      Steve