2 Replies Latest reply on Jul 18, 2009 5:24 PM by randysv

    Caused by: javax.resource.ResourceException: Transaction is

      I get the following exception when I use a timer in a task-node.
      I use an Oracle XA data source.

      03:16:06,783 ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract void javax.ejb.TimedObject.ejbTimeout(javax.ejb.Timer), causedBy:
      org.hibernate.exception.GenericJDBCException: Cannot open connection
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
      at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
      at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
      at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:145)
      at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96)
      at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
      at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
      at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
      at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)
      at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
      at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)
      at org.jbpm.logging.db.DbLoggingService.log(DbLoggingService.java:49)
      at org.jbpm.svc.save.SaveLogsOperation.save(SaveLogsOperation.java:43)
      at org.jbpm.svc.Services.save(Services.java:173)
      at org.jbpm.JbpmContext.save(JbpmContext.java:461)
      at org.jbpm.JbpmContext.autoSave(JbpmContext.java:691)
      at org.jbpm.JbpmContext.close(JbpmContext.java:129)
      at org.jbpm.ejb.impl.CommandServiceBean.execute(CommandServiceBean.java:124)
      at sun.reflect.GeneratedMethodAccessor596.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:228)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
      at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)
      at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
      at org.jboss.ejb.Container.invoke(Container.java:1029)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:436)
      at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103)
      at $Proxy162.execute(Unknown Source)
      at org.jbpm.ejb.impl.TimerEntityBean.ejbTimeout(TimerEntityBean.java:129)
      at sun.reflect.GeneratedMethodAccessor595.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1200)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:87)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:284)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
      at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:126)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:279)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:104)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:76)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
      at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)
      at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
      at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:533)
      at org.jboss.ejb.Container.invoke(Container.java:1029)
      at org.jboss.ejb.txtimer.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:104)
      at org.jboss.ejb.txtimer.FixedDelayRetryPolicy$RetryThread.run(FixedDelayRetryPolicy.java:112)
      Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57fd96:cdc8:4a5a8010:b3d status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57fd96:cdc8:4a5a8010:b3d status: ActionStatus.ABORT_ONLY >)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
      at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:92)
      at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
      ... 68 more
      Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57fd96:cdc8:4a5a8010:b3d status: ActionStatus.ABORT_ONLY >
      at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:370)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
      ... 70 more

        • 1. Re: Caused by: javax.resource.ResourceException: Transaction

          My process definition is below.

          <?xml version="1.0" encoding="UTF-8"?>
          
          <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="ACLUpdate">
          
          
           <swimlane name="RequesterClerk"></swimlane>
          
          
           <start-state name="ACLRequestStart">
           <transition to="ACL Approval" name="ToAclApproval"></transition>
           <event type="node-leave">
           <action name="CheckForProcessVariables" class="us.secureall.workflow.handler.action.CheckForProcessVariablesAction"></action>
           </event>
           </start-state>
          
          
           <task-node name="ACL Approval" create-tasks="true" async="true">
           <task blocking="true" name="ApproveACL">
           <assignment class="us.secureall.workflow.handler.assignment.ACLUpdateAssignmentHandler"></assignment>
           <timer duedate="5 seconds" transition='TimedOut'>
           <action class="us.secureall.workflow.handler.action.ApproveACLTimeOutActionHandler">
           </action>
           </timer>
           </task>
           <transition to="ApprovalNotification" name="aclapproved"></transition>
           <transition to="TimeOutNotification" name="TimedOut"></transition>
           </task-node>
          
           <state name="ApprovalNotification">
           <transition to="ACLRequestEnd" name="ApprovalToEnd"></transition>
           </state>
          
           <state name="TimeOutNotification">
           <transition to="ACLRequestEnd" name="TimeOutToEnd"></transition>
           </state>
          
          
           <end-state name="ACLRequestEnd"></end-state>
          
          
          </process-definition>
          


          The timer ejb fires successfully and my ApproveACLTimeOutActionHandler is called. But then I get the exception and the transition out of the Task Node does not happen.

          Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3f57fd96:cdc8:4a5a8010:b3d status: ActionStatus.ABORT_ONLY >
          at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:370)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
          at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
          ... 70 more


          Why is the transaction not active anymore? I don't see any exception in my code. I hardy do anything in my ApproveACLTimeOutActionHandler other than do a System.out. This seems to be a pretty common problem and it is probably JBoss' issue. A whole lot of people seem to have this issue, but there is no explanation anywhere.

          This is the piece of jboss' code where it is checking if the transaction is active and throwing an exception if it is node

          Transaction tx = tm.getTransaction();
           if (tx != null && TxUtils.isActive(tx) == false)
           throw new ResourceException("Transaction is not active: tx=" + tx);
           if (!interleaving)
           trackByTransaction = tx;
          


          Please help if anybody has a fix for this issue.

          TIA,
          Randy

          • 2. Re: Caused by: javax.resource.ResourceException: Transaction

            I do not get any exceptions if I modify my 'ApproveACLTimeOutActionHandler' by adding a call to taskInstance.end()

            public class ApproveACLTimeOutActionHandler implements ActionHandler {
            
             @Override
             public void execute(ExecutionContext executionContext) throws Exception {
             System.out.println("In ApproveACLTimeOutActionHandler");
             executionContext.getTaskInstance().end("TimedOut");
             }
            
            }
            


            So, should I be ending the task in the timer action class?
            If I remove the 'action' element altogether from inside the 'timer' element, then also I get the exception. Am I doing a mistake in writing my process definition?

            Thanks,
            Randy