3 Replies Latest reply on Aug 21, 2003 11:29 AM by adrian.brock

    Invalid Transaction ID problem again

    mjremijan

      Hi Forum,

      I've searched through the forum and found a lot of posts about Invalid Transaction ID problems. I just got one too and even though I read a lot of those previous posts, I still can't see what the cause of this exception is.

      My setup is a little bit different because I am not using MDB. My message receiver is in a servlet. During the servlet's init() method I register listener on a Topic. My workflow looks like this:

      1) Servlet gets LOCAL Session bean.
      2) Session bean gets LOCAL entity bean
      3) Entity bean updated database data
      4) Session bean gets a Topic using java:/JmsXA
      5) Session bean publishes a message to the Topic
      6) Transaction appears to commit successfully
      7) Servlet forwards to the next page
      8) Error message saying:

      19:37:37,640 WARN [SpyMessageConsumer] Message consumer closing due to error in
      listening thread.javax.jms.JMSException: Invalid transaction id.
      at org.jboss.mq.SpyXAResourceManager.ackMessage(SpyXAResourceManager.java:75)
      at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:543)
      at java.lang.Thread.run(Thread.java:534)

      Like everyone else I'd like to know why this happens and how I can fix it.

      Thanks,
      Mike

        • 1. Re: Invalid Transaction ID problem again

          Can you try this with 3.2.2RC2

          There is a fix to solve
          a race condition in the commit from suspended processing.

          The race looks something like this:

          Thread1 does some work
          Thread1 suspends - Session.close()
          Thread2 does work using same session
          Thread1 commits - The XAResource mistakenly overwrites
          the session's transaction id. It should not do this,
          it is no longer associated with the session.
          Thread2 throws an InvalidTransactionID exception

          Regards,
          Adrian

          • 2. Re: Invalid Transaction ID problem again
            mjremijan

            After much trial and error I think I got a combination that works. For sending the messages from within a transacted session bean, I use Context.lookup("java:/JmsXA") to get a TopicConnectionFactory. For clients listening on topic, I use Context.lookup("XAConnectionFactory") to get the TopicConnectionFactory. This combination seems for both successful completion of the transaction (commit) and when the transaction failes (rollback) .

            • 3. Re: Invalid Transaction ID problem again

              The (OIL) XAConnectionFactory's XAResource
              is not enlisted in the ejb transaction.

              Regards,
              Adrian