5 Replies Latest reply on Feb 14, 2016 8:40 PM by Toshiya Kobayashi

    [jBPM 6.1 - Final]  Process instance #[******] is disconnected. - Could not commit session: java.lang.RuntimeException -  Could not commit session: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call - Cannot

    Laura delli Paoli Master

      Hi,

      I have the stack trace reported below on completing am asyncronous task dath takes about one hour to complete (tried both runtime strategy is PER_REQUEST and PER_PROCESS_INSTANCE).

       

       

      I use the following code to complete the work item:

        RuntimeManager manager = getRuntimeManager();

        trace.debug("RuntimeManager created.");

        ProcessInstanceIdContext processContext = ProcessInstanceIdContext.get(processInstanceId);

        trace.debug("ProcessInstanceIdContext retrieved.");

        RuntimeEngine engine = manager.getRuntimeEngine(processContext);

        trace.debug("RuntimeEngine retrieved.");

        engine.getKieSession().getWorkItemManager().completeWorkItem(workItemId, results);

       

       

      Here is my persistence.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.0"

        xmlns="http://java.sun.com/xml/ns/persistence"

        xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">

       

       

        <persistence-unit name="org.jbpm.domain" transaction-type="JTA">

          <provider>org.hibernate.ejb.HibernatePersistence</provider>

          <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>

          <mapping-file>META-INF/Taskorm.xml</mapping-file>

          <mapping-file>META-INF/JBPMorm.xml</mapping-file>

          <mapping-file>META-INF/Executor-orm.xml</mapping-file>

          <mapping-file>META-INF/Servicesorm.xml</mapping-file>

          <mapping-file>META-INF/TaskAuditorm.xml</mapping-file>

       

       

          <!-- task service -->

          <class>org.jbpm.services.task.impl.model.AttachmentImpl</class>

          <class>org.jbpm.services.task.impl.model.ContentImpl</class>

          <class>org.jbpm.services.task.impl.model.BooleanExpressionImpl</class>

          <class>org.jbpm.services.task.impl.model.CommentImpl</class>

          <class>org.jbpm.services.task.impl.model.DeadlineImpl</class>

          <class>org.jbpm.services.task.impl.model.DelegationImpl</class>

          <class>org.jbpm.services.task.impl.model.EscalationImpl</class>

          <class>org.jbpm.services.task.impl.model.GroupImpl</class>

          <class>org.jbpm.services.task.impl.model.I18NTextImpl</class>

          <class>org.jbpm.services.task.impl.model.NotificationImpl</class>

          <class>org.jbpm.services.task.impl.model.EmailNotificationImpl</class>

          <class>org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl</class>

          <class>org.jbpm.services.task.impl.model.PeopleAssignmentsImpl</class>

          <class>org.jbpm.services.task.impl.model.ReassignmentImpl</class>

          <class>org.jbpm.services.task.impl.model.TaskImpl</class>

          <class>org.jbpm.services.task.impl.model.TaskDefImpl</class>

          <class>org.jbpm.services.task.impl.model.TaskDataImpl</class>

          <class>org.jbpm.services.task.impl.model.UserImpl</class>

          <class>org.jbpm.executor.entities.ErrorInfo</class>

          <class>org.jbpm.executor.entities.RequestInfo</class>

          <!-- Event Classes -->

          <class>org.jbpm.services.task.audit.impl.model.TaskEventImpl</class>

          

          <!-- Task Audit Classes -->

          <class>org.jbpm.services.task.audit.impl.model.AuditTaskImpl</class>

           

          <!--BAM for task service -->

          <class>org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl</class>

       

       

          <!-- engine -->

          <class>org.drools.persistence.info.SessionInfo</class>

          <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

          <class>org.drools.persistence.info.WorkItemInfo</class>

          <class>org.jbpm.persistence.correlation.CorrelationKeyInfo</class>

          <class>org.jbpm.persistence.correlation.CorrelationPropertyInfo</class>

          <!-- manager -->

          <class>org.jbpm.runtime.manager.impl.jpa.ContextMappingInfo</class>

       

       

          <!-- bam -->

          <class>org.jbpm.process.audit.ProcessInstanceLog</class>

          <class>org.jbpm.process.audit.NodeInstanceLog</class>

          <class>org.jbpm.process.audit.VariableInstanceLog</class>

       

       

          <properties>

            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />

       

       

            <property name="hibernate.max_fetch_depth" value="3" />

            <property name="hibernate.hbm2ddl.auto" value="update" />

            <property name="hibernate.show_sql" value="false" />     

            <!-- BZ 841786: AS7/EAP 6/Hib 4 uses new (sequence) generators which seem to cause problems -->

            <property name="hibernate.id.new_generator_mappings" value="false" />

            <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />

           

          </properties>

        </persistence-unit>

       

       

      </persistence>

       

       

      Can anyone help me?

       

      Laura

       

      ############################ TRACE START ############################

      18:00:38,566 WARN  [org.hibernate.ejb.AbstractEntityManagerImpl] (pool-23-thread-1) HHH000326: Cannot join transaction: do not override hibernate.transaction.factory_class

      18:00:38,571 WARN  [org.drools.persistence.SingleSessionCommandService] (pool-23-thread-1) Could not commit session: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call

        at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1210) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

        at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1160) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

        at org.drools.persistence.jpa.JpaPersistenceContext.joinTransaction(JpaPersistenceContext.java:66) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:490) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:73) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:60) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:353) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:145) [drools-core-6.1.0.Final.jar:6.1.0.Final]

      18:00:38,566 WARN  [org.hibernate.ejb.AbstractEntityManagerImpl] (pool-23-thread-1) HHH000326: Cannot join transaction: do not override hibernate.transaction.factory_class

      18:00:38,571 WARN  [org.drools.persistence.SingleSessionCommandService] (pool-23-thread-1) Could not commit session: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call

        at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1210) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

        at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1160) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

        at org.drools.persistence.jpa.JpaPersistenceContext.joinTransaction(JpaPersistenceContext.java:66) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:490) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:73) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:60) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:353) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:145) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        .....

        at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:54) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:133) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:369) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.SplitInstance.executeStrategy(SplitInstance.java:117) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:63) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:313) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:44) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:329) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:306) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:312) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:374) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:350) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:404) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:132) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:54) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:133) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:369) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.SplitInstance.executeStrategy(SplitInstance.java:117) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:63) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:313) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:44) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:329) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:306) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:312) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:374) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:350) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:404) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:132) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:54) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:133) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:313) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:44) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:329) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:306) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:312) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:374) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:350) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:404) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:132) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:74) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:35) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:509) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:73) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:60) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:353) [drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]

        at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:145) [drools-core-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.executor.impl.wih.AsyncWorkItemHandlerCmdCallback.onCommandDone(AsyncWorkItemHandlerCmdCallback.java:62) [jbpm-executor-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.executor.impl.AvailableJobsExecutor.executeJob(AvailableJobsExecutor.java:125) [jbpm-executor-6.1.0.Final.jar:6.1.0.Final]

        at org.jbpm.executor.impl.ExecutorRunnable.run(ExecutorRunnable.java:42) [jbpm-executor-6.1.0.Final.jar:6.1.0.Final]

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_09-icedtea]

        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351) [rt.jar:1.7.0_09-icedtea]

        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) [rt.jar:1.7.0_09-icedtea]

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [rt.jar:1.7.0_09-icedtea]

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [rt.jar:1.7.0_09-icedtea]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09-icedtea]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09-icedtea]

        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]

      18:00:38,881 WARN  [org.drools.persistence.SingleSessionCommandService] (pool-23-thread-1) Could not commit session: java.lang.RuntimeException: Process instance 286[******] is disconnected.

        • 1. Re: [jBPM 6.1 - Final]  Process instance #[******] is disconnected. - Could not commit session: java.lang.RuntimeException -  Could not commit session: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call - Can
          Maciej Swiderski Master

          looks like the transaction times out when process instance is still executing. Based on the stack trace looks like executor finishes and push the process instance forward but there are some work items that might be taking lots of time and that causes transaction to timeout. So either make sure that long running operations are done async or increase transaction timeout on server.

           

          HTH

          • 2. Re: [jBPM 6.1 - Final]  Process instance #[******] is disconnected. - Could not commit session: java.lang.RuntimeException -  Could not commit session: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call - Can
            Laura delli Paoli Master

            Thanks for your answer, Maciej.

             

             

            I thought I had managed the workitem asynchronously, below you can see my implementation.

            Can you explain me if this implementation is asynchronous?

            If it is NOT asynchronous how can I make it asynchronous?

            How can I increase transaction timeout on server?

             

             

            Thanhs in advance

             

             

            Laura

             

             

              public class LongRunningTaskHandler extends MyWorkItemHandler {

             

             

                  private static Logger trace = Logger.getLogger(LongRunningTaskHandler.class);

                  private KieSession ksession;

             

             

                   public LongRunningTaskHandler(KieSession ksession) {

                        super();

                       this.ksession = ksession;

                   }

             

             

                   @Override

                   public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {

                        className = this.getClass().getSimpleName();

                        trace.info(className + "{executeWorkItem} START");

                       final long pid = workItem.getProcessInstanceId();

                        final long wiId = workItem.getId();

                        trace.info("Running LongRunningTaskHandler for work item " + wiId + " for process " + pid);

                        trace.info(className + "{executeWorkItem} ABOUT TO DELEGATE");

                        new LongRunningTaskExecutor(workItem, manager, ksession).run();

                   }

             

             

              }

             

              public class LongRunningTaskExecutor implements Runnable extends CommandLineLongRunningTaskExecutorAbstract {

                      private static Logger trace = Logger.getLogger(FFmpegTaskExecutor.class);

             

             

                   public LongRunningTaskExecutor(WorkItem workitem, WorkItemManager workItemManager, KieSession ksession) {

                        super(workitem, workItemManager, ksession);

                   }

             

             

                   @Override

                   public void run() {

                        Object[] executionResult = runLongRunningTaskInternal();

                        try {

                             completeLongRunningTask(executionResult);

                        } catch (Throwable e) {

                        executionResult = buildFailureExecutionResults(-1, notes);

                   }

              }

             

             

                   private Object[] runLongRunningTaskInternal() {

                   Object[] executionResult = null;

                    // deos the stuffs

                   return executionResult;

                   }

             

             

                   private void completeLongRunningTask(Object[] executionResult) throws Throwable {

                        SaakAkServices saakAkServices = SaakAkServices.getInstance();

                        Map<String, Object> result = buildWorkItemResultsMap(executionResult);

                        RuntimeManager manager = getRuntimeManager();

                        trace.debug("RuntimeManager created.");

                        ProcessInstanceIdContext processContext = ProcessInstanceIdContext.get(processInstanceId);

                        trace.debug("ProcessInstanceIdContext retrieved.");

                        RuntimeEngine engine = manager.getRuntimeEngine(processContext);

                        trace.debug("RuntimeEngine retrieved.");

                       engine.getKieSession().getWorkItemManager().completeWorkItem(workItemId, results);

                   }

              }

            • 3. Re: [jBPM 6.1 - Final]  Process instance #[******] is disconnected. - Could not commit session: java.lang.RuntimeException -  Could not commit session: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call - Can
              Laura delli Paoli Master

              Hi,

              I found my error, I Had to create a thread and use the start method (thath is asynchronous) instead of using the run method of Runnable (thath is synchronous)  :$

               

               

              public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {

                          className = this.getClass().getSimpleName();

                          trace.info(className + "{executeWorkItem} START");

                         final long pid = workItem.getProcessInstanceId();

                          final long wiId = workItem.getId();

                          trace.info("Running LongRunningTaskHandler for work item " + wiId + " for process " + pid);

                          trace.info(className + "{executeWorkItem} ABOUT TO DELEGATE");

                          LongRunningTaskExecutor executor = new LongRunningTaskExecutor(workItem, manager, ksession);

                          Thread main = new Thread(executor);

                          main.start();

                     }

               

               

              HTH

               

               

              Laura

              • 4. Re: [jBPM 6.1 - Final]  Process instance #[******] is disconnected. - Could not commit session: java.lang.RuntimeException -  Could not commit session: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call - Can
                Aibek Makhimov Newbie

                Hello!
                I have a similar situation.

                 

                Stack trace:

                16:59:27,202 ERROR [kz.inessoft.egov.pep.security.rest.DefaultExceptionMapper] (http-/127.0.0.1:8080-1) Unhandled error occurred: Process instance 10751[kz.inessoft.egov.pep.approvable.p3012.common.process] is disconnected.: java.lang.RuntimeException: Process instance 10751[kz.inessoft.egov.pep.approvable.p3012.common.process] is disconnected.

                    at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:90) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

                    at org.jbpm.process.instance.impl.ProcessInstanceImpl.getContextInstance(ProcessInstanceImpl.java:161) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

                    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setVariable(WorkflowProcessInstanceImpl.java:269) [jbpm-flow-6.1.0.Final.jar:6.1.0.Final]

                    at kz.inessoft.egov.pep.p3012.rest.TestResource.startTest(TestResource.java:66) [classes:] ...

                 

                This error comes after this code:

                public Response startTest() {

                  initKieSession();

                 

                   long processId = 10751;

                  ProcessInstance processInstance = kieSession.getProcessInstance(processId);

                   if (processInstance.getState() == 1) {

                   RuleFlowProcessInstance rfpi = (RuleFlowProcessInstance) processInstance;

                  kz.inessoft.egov.pep.jbpm.process.ApprovableProcessData approvableProcessDataSaved =

                  (kz.inessoft.egov.pep.jbpm.process.ApprovableProcessData) rfpi.getVariable(Constants.PARAM_APPROVABLE_PROCESS_DATA);

                // In this line, the error decreases, as I understand it requires a transaction
                   rfpi.setVariable(Constants.PARAM_APPROVABLE_PROCESS_DATA, toApprovableProcessData(approvableProcessDataSaved));

                  }

                 

                   return null;

                }

                 

                How can I do that?

                 

                • 5. Re: [jBPM 6.1 - Final]  Process instance #[******] is disconnected. - Could not commit session: java.lang.RuntimeException -  Could not commit session: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call - Can
                  Toshiya Kobayashi Newbie

                  Hi,

                   

                  You need to span a transaction from getProcessInstance() and setVariable() in order to have the ProcessInstance object "connected".

                   

                  You can do that by using a UserTransaction begin/commit. Also you can do that by a Command conveniently.

                   

                      ksession.execute(new GenericCommand<Void>() {

                          public Void execute(Context context) {

                              KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();

                              ProcessInstance processInstance = (ProcessInstance) ksession.getProcessInstance(piid);

                              ((WorkflowProcessInstance)processInstance).setVariable("Var1", "123");

                              return null;

                          }

                      });

                   

                  Hope this helps.

                   

                  Toshiya