0 Replies Latest reply on Aug 23, 2002 1:17 PM by Brian Johnson

    XA Resources not enlisted in UserTransaction from Servlet

    Brian Johnson Newbie

      I am using jboss 3.0.1 with Jetty, jdk1.4 on Windows 2000. The problem I am having is that when I start a UserTransaction from the service thread of a Servlet, XA Resources (such as the XA Oracle and XA Firebird Datasources) that are retrieved using JNDI from threads spawned by the service thread are not enlisted in the transaction. I have looked over the spec, and I believe this should work as long as being(), commit() and rollback() are only called from the service thread. It's too much code to include, but here is the idea:

      in service method...
      InitialContext ctx = new InitialContext();
      UserTransaction trans = (UserTransaction)ctx.lookup("java:comp/UserTransaction");

      call method on object which spawns new Thread...
      Context initialContext = new InitialContext();
      dataSource = (DataSource)initialContext.lookup( "java:/XAOracleDS" );
      Connection conn = dataSource.getConnection();
      do work....

      return to service thread...

      The second, seemingly unrelated problem, is that I cannot access the comp/env references created in web.xml and jboss-web.xml.
      The behavior is the same whether I include the UserTransaction calls or not. The transaction is left open until it either times out or jboss is shut down, at which point it finally commits. Any ideas? I searched the forums and newsgroups and can't find anything. Thanks.