Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1270

UserTransaction with non default ProviderURL

    XMLWordPrintable

Details

    Description

      Problem to initiate an UserTransaction from client with non default providerURL.

      java.util.Hashtable env = new java.util.Hashtable();
      env.put( Context.PROVIDER_URL, "myserver:1199");
      InitialContext ctx = new InitialContext(env);

      javax.transaction.UserTransaction tx = (UserTransaction) ctx.lookup("UserTransaction");

      The lookup cause an stacktrace like this :

      08:36:54,531 DEBUG [AWT-EventQueue-0] (NamingContext.java:1192) - Failed to connect to 172.30.1.22:1099
      javax.naming.CommunicationException: Failed to connect to server 172.30.1.22:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 172.30.1.22:1099 [Root exception is java.net.ConnectException: Connection timed out: connect]]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:213)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1187)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:516)

      The provider "172.30.1.22:1099" is the default provider in my jndi properties file which is not online at this time.
      I think the problem is in org.jboss.tm.usertx.client.ClientUserTransactionObjectFactory, which will be called in lookup handling.
      The getUserTransaction() tries to create an new InitialContext with default parameters. It should use the context available by getObjectInstance(..).

      An additional problem to this is in class org.jboss.tm.usertx.client.ClientUserTransaction :

      private synchronized void createSession()
      {
      // Destroy any old session.
      if (session != null)
      destroySession();

      try

      { // Get a reference to the UT session factory. UserTransactionSessionFactory factory; factory = (UserTransactionSessionFactory)new InitialContext().lookup("UserTransactionSessionFactory"); // Call factory to get a UT session. session = factory.newInstance(); }

      catch (Exception ex)

      { throw new RuntimeException("UT factory lookup failed: " + ex); }

      }

      This occurs when begin() is invoked. Same problem with new InitialContext().

      In class ServerVMClientUserTransaction the same problem.

      Attachments

        Issue Links

          Activity

            People

              starksm64 Scott Stark (Inactive)
              dirkniemeierde Dirk Niemeier (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: