3 Replies Latest reply on Sep 14, 2004 11:51 AM by harajuku_01

    UserTransaction.begin behaves differently from 3.2.3 to 4.0.

    harajuku_01 Newbie

      Hi Forum,

      Originally, I write a small external stand-alone client to use the UserTransaction from JBoss to send JMS message. I eliminate other extra JMS code and show my problem in the following. It works when talking to JBoss 3.2.3. However, if I run the same piece of code to talk to JBoss 4.0.0RC1, I receive "UT factory lookup failed: java.lang.IllegalStateException".

      I have checked the release notes and didn't find anything relevant.

      Sorry if I post this in a wrong forum. Can someone shred some light on this?

      I really appreciate your help.

      Thanks,
      Hara

       UserTransaction ut = null;
      
       Context ctx = null;
       Hashtable ht = new Hashtable();
      
       try {
       ht.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
       ht.put(Context.PROVIDER_URL,"jnp://localhost:1099");
       ctx = new InitialContext(ht);
      
       ut = (UserTransaction)ctx.lookup("UserTransaction");
       System.out.println("\t ut returned: "+ut.getClass().getName()+"\n");
       ut.begin();
       ut.commit();
       }
       catch (Exception e) {
       e.printStackTrace();
       }
      
      ======== JBoss 3.2.3 log ========
      
      2004-09-13 12:45:24,507 TRACE [org.jboss.tm.TransactionManagerService] Constructing
      2004-09-13 12:45:24,507 TRACE [org.jboss.tm.TxManager] tx timeout is now: 0s
      2004-09-13 12:45:24,507 TRACE [org.jboss.tm.TransactionImpl] Created new instance for
      
      tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=SHINJUKU//19, BranchQual=]
      2004-09-13 12:45:24,507 TRACE [org.jboss.tm.TxManager] began tx: TransactionImpl:XidImpl [FormatId=257,
      
      GlobalId=SHINJUKU//19, BranchQual=]
      2004-09-13 12:45:24,507 TRACE [org.jboss.tm.TransactionManagerService] Constructing
      2004-09-13 12:45:24,507 TRACE [org.jboss.tm.TxManager] suspended tx: TransactionImpl:XidImpl [FormatId=257,
      
      GlobalId=SHINJUKU//19, BranchQual=]
      2004-09-13 12:45:24,537 TRACE [org.jboss.tm.TxManager] resumed tx: TransactionImpl:XidImpl [FormatId=257,
      
      GlobalId=SHINJUKU//19, BranchQual=]
      2004-09-13 12:45:24,537 TRACE [org.jboss.tm.TransactionImpl] Committing, tx=TransactionImpl:XidImpl
      
      [FormatId=257, GlobalId=SHINJUKU//19, BranchQual=], status=STATUS_ACTIVE
      2004-09-13 12:45:24,537 TRACE [org.jboss.tm.TransactionImpl] Before completion done, tx=TransactionImpl:XidImpl
      
      [FormatId=257, GlobalId=SHINJUKU//19, BranchQual=], status=STATUS_ACTIVE
      2004-09-13 12:45:24,537 TRACE [org.jboss.tm.TransactionImpl] Zero phase commit: No resources.
      2004-09-13 12:45:24,537 TRACE [org.jboss.tm.TransactionImpl] Committed OK, tx=TransactionImpl:XidImpl
      
      [FormatId=257, GlobalId=SHINJUKU//19, BranchQual=]
      2004-09-13 12:45:24,537 TRACE [org.jboss.tm.TxManager] commited tx: TransactionImpl:XidImpl [FormatId=257,
      
      GlobalId=SHINJUKU//19, BranchQual=]
      
      ======== JBoss 4.0.0RC1 log ========
      
      2004-09-13 13:11:00,442 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin ReadTask.run2004-09-13 13:11:00,442
      
      DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin WriteTask.run2004-09-13 13:11:00,442 DEBUG
      
      [org.jboss.mq.il.uil2.SocketManager] Created ObjectOutputStream2004-09-13 13:11:00,442 DEBUG
      
      [org.jboss.mq.il.uil2.SocketManager] Created ObjectInputStream2004-09-13 13:11:00,502 DEBUG
      
      [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Setting up the UILClientIL Connection2004-09-13 13:11:00,502
      
      DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] The UILClientIL Connection is set up2004-09-13
      
      13:11:01,523 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Exiting on IOEjava.net.SocketException:
      
      Connection reset at java.net.SocketInputStream.read(Unknown Source) at
      
      java.io.BufferedInputStream.fill(Unknown Source) at java.io.BufferedInputStream.read(Unknown Source)
      
      at org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:67) at
      
      java.io.ObjectInputStream$PeekInputStream.peek(Unknown Source) at
      
      java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(Unknown Source) at
      
      java.io.ObjectInputStream$BlockDataInputStream.refill(Unknown Source) at
      
      java.io.ObjectInputStream$BlockDataInputStream.read(Unknown Source) at
      
      java.io.ObjectInputStream$BlockDataInputStream.readByte(Unknown Source) at
      
      java.io.ObjectInputStream.readByte(Unknown Source) at
      
      org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:279) at java.lang.Thread.run(Unknown
      
      Source)2004-09-13 13:11:01,533 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run2004-09-13
      
      13:11:01,533 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run
      
      
      ======== client throws exception when talking to JBoss 4.0.0RC1 ========
      
       ut returned: org.jboss.tm.usertx.client.ClientUserTransaction
      
      javax.transaction.SystemException: java.lang.RuntimeException: UT factory lookup
       failed: java.lang.IllegalStateException: Failed to find method for hash:5066195
      438591816788 available mappings: {-7735902332893138073=public abstract java.lang
      .Object org.jboss.tm.usertx.interfaces.UserTransactionSession.begin(int) throws
      java.rmi.RemoteException,javax.transaction.NotSupportedException,javax.transacti
      on.SystemException, 4084914802091091921=public abstract void org.jboss.tm.usertx
      .interfaces.UserTransactionSession.commit(java.lang.Object) throws java.rmi.Remo
      teException,javax.transaction.RollbackException,javax.transaction.HeuristicMixed
      Exception,javax.transaction.HeuristicRollbackException,java.lang.SecurityExcepti
      on,java.lang.IllegalStateException,javax.transaction.SystemException, 6315673022
      836612424=public abstract void org.jboss.tm.usertx.interfaces.UserTransactionSes
      sion.setRollbackOnly(java.lang.Object) throws java.rmi.RemoteException,java.lang
      .IllegalStateException,javax.transaction.SystemException, 1297379752452928667=pu
      blic abstract void org.jboss.tm.usertx.interfaces.UserTransactionSession.rollbac
      k(java.lang.Object) throws java.rmi.RemoteException,java.lang.SecurityException,
      java.lang.IllegalStateException,javax.transaction.SystemException, -892088777694
      5416620=public abstract org.jboss.tm.usertx.interfaces.UserTransactionSession or
      g.jboss.tm.usertx.interfaces.UserTransactionSessionFactory.newInstance() throws
      java.rmi.RemoteException, -8159502623153744977=public abstract int org.jboss.tm.
      usertx.interfaces.UserTransactionSession.getStatus(java.lang.Object) throws java
      .rmi.RemoteException,javax.transaction.SystemException, 5874023380897232108=publ
      ic abstract void org.jboss.tm.usertx.interfaces.UserTransactionSession.destroy()
       throws java.rmi.RemoteException}
       at org.jboss.tm.usertx.client.ClientUserTransaction.begin(ClientUserTran
      saction.java:107)
       at JbTxClientXA2.init(JbTxClientXA2.java:41)
       at JbTxClientXA2.main(JbTxClientXA2.java:53)