4 Replies Latest reply on Nov 9, 2013 6:54 AM by wdfink

    Problem to lookup client side UserTransation from HA-JNDI

    herthie57

      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.

        • 1. Re: Problem to lookup client side UserTransation from HA-JND
          dirkniemeierde

          Hi,
          did you find a solution for the problem yet ?

          regards,
          Dirk

          • 2. Re: Problem to lookup client side UserTransation from HA-JND
            herthie57

            Sorry I still not have any solution, just a workaround which is not to use HA-JNDI if you plan to use UserTransaction but normal JNDI instead.

            I have no certitude but just feeling that the fact client side can access the java:/xxx HA-JNDI namespace (which is normally forbidden from client side) is due to the way HA-JNDI works. Indeed in HA-JNDI if one node cannot lookup a given entry in its local JNDI repository then it forwards the request to the second node. Also I suppose the second node can return a value since it is requested from a sever space (the 1st node). This might also explain why the problem disappears when only one node is running. But this is only suppositions...

            I tied to post a bug report but didn?t found any link for that on JBoss site. If someone can help?

            Best regards,
            Thierry.

            • 3. Re: Problem to lookup client side UserTransation from HA-JNDI
              memyself141

              Hi, I am facing a similar problem... When I invoke InitialContext.lookup("UserTransaction") from a POJO client, it returns me a ClientUserTransaction which works fine however, when I do the same from an application deployed on a JBoss server (my client is also a JBoss Server), I get a ServerVMClientUserTransaction which does not participate in the transaction at the server.... What should I do to get this done??

              • 4. Re: Problem to lookup client side UserTransation from HA-JNDI
                wdfink

                Hi Aayush,

                welcome to the forum.

                Instead of post to an 8 year old thread wich mean definitive a different version you should open a new question and provide more details about the used version and your code.