Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-8483

Geode JCALocalTransaction fails to begin a JTA last resource transaction if the TransactionManager is not bound into JNDI

    XMLWordPrintableJSON

    Details

      Description

      The exception is:

      [error 2020/08/18 22:57:03.997 UTC <Default Executor-thread-4> tid=0x20] Application run failed
      Caused by: org.springframework.transaction.TransactionSystemException: UOWManager transaction processing failed; nested exception is com.ibm.wsspi.uow.UOWException: javax.transaction.HeuristicMixedException
      	at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:313)
      	at example.jta.client.Client.iterateAndCreateTrades(Client.java:93)
      	at example.jta.client.Client.loadEntries(Client.java:74)
      Caused by: com.ibm.wsspi.uow.UOWException: javax.transaction.HeuristicMixedException
      	at com.ibm.ws.uow.embeddable.EmbeddableUOWManagerImpl.runUnderNewUOW(EmbeddableUOWManagerImpl.java:757)
      	at com.ibm.ws.uow.embeddable.EmbeddableUOWManagerImpl.runUnderUOW(EmbeddableUOWManagerImpl.java:329)
      	at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:306)
      Caused by: javax.transaction.HeuristicMixedException
      	at com.ibm.tx.jta.impl.TransactionImpl.commit(TransactionImpl.java:715)
      	at com.ibm.tx.jta.impl.TranManagerImpl.commit(TranManagerImpl.java:165)
      	at com.ibm.tx.jta.impl.TranManagerSet.commit(TranManagerSet.java:113)
      	at com.ibm.ws.uow.embeddable.EmbeddableUOWManagerImpl.uowCommit(EmbeddableUOWManagerImpl.java:834)
      	at com.ibm.ws.uow.embeddable.EmbeddableUOWManagerImpl.uowEnd(EmbeddableUOWManagerImpl.java:812)
      	at com.ibm.ws.uow.embeddable.EmbeddableUOWManagerImpl.runUnderNewUOW(EmbeddableUOWManagerImpl.java:754)
      Caused by: javax.transaction.xa.XAException
      	at com.ibm.ejs.j2c.LocalTransactionWrapper.commit(LocalTransactionWrapper.java:157)
      	at com.ibm.tx.jta.impl.OnePhaseResourceImpl.commit_one_phase(OnePhaseResourceImpl.java:113)
      	at com.ibm.tx.jta.impl.RegisteredResources.flowCommitOnePhase(RegisteredResources.java:2045)
      	at com.ibm.tx.jta.impl.TransactionImpl.commitXAResources(TransactionImpl.java:1478)
      	at com.ibm.tx.jta.impl.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:801)
      	at com.ibm.tx.jta.impl.TransactionImpl.processCommit(TransactionImpl.java:768)
      	at com.ibm.tx.jta.impl.TransactionImpl.commit(TransactionImpl.java:711)
      Caused by: javax.resource.spi.LocalTransactionException: java.lang.IllegalStateException: Thread does not have an active transaction
      	at org.apache.geode.internal.ra.spi.JCALocalTransaction.commit(JCALocalTransaction.java:116)
      	at com.ibm.ejs.j2c.LocalTransactionWrapper.commit(LocalTransactionWrapper.java:145)
      

      Here is a truncated version of JCALocalTransaction.begin:

      public void begin() throws ResourceException {
        TransactionManager tm = this.cache.getJTATransactionManager();
        if (tm != null && tm.getTransaction() != null) {
            this.gfTxMgr.begin();
        } else {
          if (logger.fineEnabled()) {
            logger.fine("JCAManagedConnection: JTA Transaction does not exist.");
          }
        }
      }
      

      It attempts to get the TransactionManager (which in this case is a com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerSet). If it is null (not bound) or it doesn't have a Transaction in progress, it logs a message at fine level and returns.

      A stack trace in JCALocalTransaction.begin shows the call stack:

      java.lang.Exception
      	at org.apache.geode.internal.ra.spi.JCALocalTransaction.begin(JCALocalTransaction.java:54)
      	at com.ibm.ejs.j2c.LocalTransactionWrapper.start(LocalTransactionWrapper.java:668)
      	at com.ibm.ws.Transaction.JTA.JTAResourceBase.start(JTAResourceBase.java:121)
      	at com.ibm.tx.jta.impl.RegisteredResources.startRes(RegisteredResources.java:835)
      	at com.ibm.tx.jta.impl.RegisteredResources.enlistResource(RegisteredResources.java:289)
      	at com.ibm.tx.jta.impl.TransactionImpl.enlistResource(TransactionImpl.java:1991)
      	at com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerSet.enlistOnePhase(EmbeddableTranManagerSet.java:184)
      	at com.ibm.ws.transaction.services.TransactionManagerService.enlistOnePhase(TransactionManagerService.java:366)
      	at com.ibm.ejs.j2c.LocalTransactionWrapper.enlist(LocalTransactionWrapper.java:412)
      	at com.ibm.ejs.j2c.ConnectionManager.initializeForUOW(ConnectionManager.java:1037)
      	at com.ibm.ejs.j2c.ConnectionManager.involveMCInTran(ConnectionManager.java:699)
      	at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:316)
      	at org.apache.geode.internal.ra.GFConnectionFactoryImpl.getConnection(GFConnectionFactoryImpl.java:44)
      	at org.apache.geode.internal.ra.GFConnectionFactoryImpl.getConnection(GFConnectionFactoryImpl.java:25)
      	at org.springframework.data.gemfire.config.annotation.support.AbstractGemFireAsLastResourceAspectSupport$GemFireConnectionHolder.acquire(AbstractGemFireAsLastResourceAspectSupport.java:525)
      	at org.springframework.data.gemfire.config.annotation.support.GemFireAsLastResourceConnectionAcquiringAspect.doGemFireConnectionFactoryGetConnection(GemFireAsLastResourceConnectionAcquiringAspect.java:61)
        ...
      	at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:371)
      	at com.ibm.ws.uow.embeddable.EmbeddableUOWManagerImpl.runUnderNewUOW(EmbeddableUOWManagerImpl.java:736)
      	at com.ibm.ws.uow.embeddable.EmbeddableUOWManagerImpl.runUnderUOW(EmbeddableUOWManagerImpl.java:329)
      	at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:306)
        ...
      	at example.jta.client.controller.TradeController.iterateAndCreateTrades(TradeController.java:48)
      	at example.jta.client.controller.TradeController.createTrades(TradeController.java:36)
      

      AFAICT, these checks are unnecessary since the EmbeddableTranManagerSet is involved in the call to begin.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                boglesby Barrett Oglesby
                Reporter:
                boglesby Barrett Oglesby
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: