0 Replies Latest reply on Jan 5, 2007 7:56 PM by Roger Bacalzo

    How do I configure JBossTS for distributed UserTransactions

    Roger Bacalzo Newbie


      My java test application hangs when trying to do some remote EJB operations within a UserTransaction in a JBossAS cluster.

      I am unsure whether this is due to an improperly configured environment or some other cause.


      I have 2 JbossAS servers set up in a cluster on the same machine

      I have a Junit test, also on same machine, that basically does the following:

      1. Get UserTransaction
      2. ut.begin()
      3. Invoke operation on EJB1
      4. Invoke operation on EJB2
      5. ut.commit()

      To get my junit test to run with JBossTS, I found that at a minimum, I needed to add the following to my client CLASSPATH:


      From the docs, I wasn?t sure whether the following are also required, although I did add them anyway, with no apparent difference to the outcome of my test:


      Also, do I need either jbossjts-properties.xml or jacorb.properties in the current working directory of my Java client?

      Finally, how do I turn on distributed transaction support in the JBossAS using JBossTS? I believe I followed all of the instructions in the JbossTS INSTALL file. However, there are a number of options in jbossjts-properties.xml, which I?m not sure I?ve modified correctly.

      Here are the properties I?ve changed, the others I left to their defaults.

      I believe this is the minimum change required to support distributed transactions.

      <property name="com.arjuna.ats.arjuna.coordinator.commitOnePhase" value="NO"/>

      Note that server1 in the cluster has nodeIdentifier set to ?1? and server2 has it set to ?2?. Does this have to be an Integer value or can it be a String. Ideally, I would want it to be the same as my server name (e.g. ?server1?)
      <property name="com.arjuna.ats.arjuna.xa.nodeIdentifier" value="2"/>

      I wasn't sure whether these changes were required, but changing them didn't seem to cause any harm.
      <property name="com.arjuna.ats.jts.alwaysPropagateContext" value="YES"/>
       <property name="com.arjuna.ats.jts.checkedTransactions" value="YES"/>

      Note that I also tried changing the following properties, but found that JBossAS did not start up correctly with these changed from the default value of ?NO?.

      <property name="com.arjuna.ats.jts.transactionManager" value=?YES"/>
       <property name="com.arjuna.ats.jts.needTranContext" value=?YES"/>

      With my current configuration, my junit test hangs waiting for a response on the Invocation of EJB2 which uses data created in a MSSQL Server database in EJB1.

      Note that if I run only 1 JBossAS in the cluster, then this test runs fine.

      If I remove the UserTransaction around the invocations of EJB1 and EJB2, then the junit test also runs fine when both servers are running in the cluster.

      So it is only the combination of the UserTransaction and multiple servers in the cluster that cause the test to hang.