4 Replies Latest reply on Nov 9, 2013 6:54 AM by Wolf-Dieter Fink

    Problem to lookup client side UserTransation from HA-JNDI

    Thierry Hermann Newbie

      Hi,

      I have configured JBoss 3.2.5 on a 2 nodes cluster. Every thing is working
      fine except when I try to lookup ?UserTransaction? from client side.

      When both nodes are running at same time the stand-alone client lookup method always returns an instance of ServerVMClientUserTransaction instead of ClientUserTransaction.

      This problem only occurs when looking up on HA-JNDI but works fine when using standard JNDI.

      Note also that when only one node is running the HA-JNDI lookup returns the correct ClientUserTransaction instance.

      I tried to trace JBoss and found somting strange in org.jboss.tm.usertx.client.ClientUserTransactionObjectFactory.getUserTransaction() method.

      static private UserTransaction getUserTransaction()
      {
      if (userTransaction == null) {
      // See if we have a local TM
      try {
      new InitialContext().lookup("java:/TransactionManager");

      // We execute in the server.
      userTransaction = ServerVMClientUserTransaction.getSingleton();
      } catch (NamingException ex) {
      // We execute in a stand-alone client.
      userTransaction = ClientUserTransaction.getSingleton();
      }
      }
      return userTransaction;
      }

      It seems that when only one node is running "java:/TransactionManager" is not visible from client side but is visible when at least 2 Nodes are running that's the reason way I get the Server side instance of UserTransaction instead of Client side.

      Please let me know if it?s a JBoss bug or if I missed something in my HA-JNDI configuration.

      Thanks,
      Thierry.