4 Replies Latest reply on Jul 14, 2004 4:02 PM by ms26368

    Transaction enlist error

    ms26368 Newbie

      I am getting this error in production. I have no idea how to prevent it from reoccurring again.

      2004-06-09 12:16:48,352 WARN [org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener] in Enlisting tx, trying to change tx. illegal state: old: TransactionImpl:XidImpl [FormatId=257, GlobalId=ahsun07//572961, BranchQual=], new: TransactionImpl:XidImpl [FormatId=257, GlobalId=ahsun07//572965, BranchQual=], cel: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@17aac47
      2004-06-09 12:16:48,354 ERROR [STDERR] java.lang.IllegalStateException: Trying to change Tx in enlist!
      2004-06-09 12:16:48,355 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:437)
      2004-06-09 12:16:48,356 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:358)
      2004-06-09 12:16:48,356 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:490)
      2004-06-09 12:16:48,356 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:798)
      2004-06-09 12:16:48,356 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)

        • 1. Re: Transaction enlist error
          Adrian Brock Master

          The message says you are trying to reuse a connection in two different transactions.
          Most likely because you are breaking the pooling, e.g. holding the connection in a
          static field.

          • 2. Re: Transaction enlist error
            ms26368 Newbie

            i have session bean which is container managed transaction. this session bean calls the entity beans method and another method which executes sql statements. now the method which executes sql statement open another database connection.

            here is the method of session bean

            getcontract()
            {
            entity.findByPrimaryKey --- opens database connection
            getDevice() --- opens another database connection

            }

            here is the question i have
            1) can i change the session bean to bean managed transaction?
            2) what the default transaction attribute for container managed transaction?
            3) is there any quick fix for this kind of problem with this kind of coding pattern?

            Thanks for your reply

            • 3. Re: Transaction enlist error
              Adrian Brock Master

              Your code shows no pooling.

              Specifc Answers:
              1) Yes
              2) Required
              3) You don't show your database access pattern.

              • 4. Re: Transaction enlist error
                ms26368 Newbie

                I have resolved this issue. the issue was container configured with no entity bean locking so, two thread tries to access the same entity bean causing this error