Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-3862

Running task operation and process execution in one transaction for jBPM Console

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: jBPM 5.4.0.CR1
    • Fix Version/s: jBPM 6.0.0.Beta5
    • Component/s: Console
    • Labels:
      None
    • Environment:

      jBPM 5.4.0.Final

    • Steps to Reproduce:
      Hide
      • Install jBPM 5.4.0 with installer
      • Configure 'Local' in jbpm-gwt-console-server.war/WEB-INF/classes/default.jbpm.console.properties
        jbpm.console.task.service.strategy=Local
        
      • Configure LocalHTWorkItemHandler in jbpm-gwt-console-server.war/WEB-INF/classes/default.session.template
        "Human Task" : "new org.jbpm.process.workitem.wsht.LocalHTWorkItemHandler(taskClient, ksession, org.jbpm.task.utils.OnErrorAction.LOG)"
        
      • Add "org.jbpm.task" persistence unit in jbpm-gwt-console-server.war/WEB-INF/classes/META-INF/persistence.xml (Also add Taskorm-JPA2.xml)
          <persistence-unit name="org.jbpm.task" transaction-type="JTA">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
            <mapping-file>META-INF/Taskorm-JPA2.xml</mapping-file>
        
            <class>org.jbpm.task.Attachment</class>
            <class>org.jbpm.task.BooleanExpression</class>
            <class>org.jbpm.task.Comment</class>
            <class>org.jbpm.task.Content</class>
            <class>org.jbpm.task.Deadline</class>
            <class>org.jbpm.task.Delegation</class>
            <class>org.jbpm.task.EmailNotification</class>
            <class>org.jbpm.task.EmailNotificationHeader</class>
            <class>org.jbpm.task.Escalation</class>
            <class>org.jbpm.task.Group</class>
            <class>org.jbpm.task.I18NText</class>
            <class>org.jbpm.task.Notification</class>
            <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
            <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
            <class>org.jbpm.task.PeopleAssignments</class>
            <class>org.jbpm.task.Reassignment</class>
            <class>org.jbpm.task.Status</class>
            <class>org.jbpm.task.SubTasksStrategy</class>
            <class>org.jbpm.task.Task</class>
            <class>org.jbpm.task.TaskData</class>
            <class>org.jbpm.task.User</class>
            <properties>
              <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
              <property name="hibernate.max_fetch_depth" value="3"/>
              <property name="hibernate.show_sql" value="false" />
              <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
        
              <!-- 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" />
            </properties>
          </persistence-unit>
        
      • Import attached repository_export_rollbacktest.xml via Guvnor
      • Login to jBPM Console as john
      • Start 'rollbacktest' process via jBPM Console
      • Start a Task for john
      • The ScriptTask throws NumberFormatException and the process execution is rolled back. But the Human Task is 'Completed' in the database.
      14:09:27,185 ERROR [org.drools.persistence.SingleSessionCommandService] (http-localhost-127.0.0.1-8080-18) Could not commit session: org.jbpm.workflow.instance.WorkflowRuntimeException: [defaultPackage.rollbacktest:2 - ScriptTask:3] -- unable to execute Action: null
              at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:216) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:196) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:247) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:90) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemAborted(WorkItemNodeInstance.java:301) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:287) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
              at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.abortWorkItem(JPAWorkItemManager.java:154) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
              at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:56) [drools-core-5.5.0.Final.jar:5.5.0.Final]
              at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:29) [drools-core-5.5.0.Final.jar:5.5.0.Final]
              at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-5.5.0.Final.jar:5.5.0.Final]
              at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
              at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.abortWorkItem(CommandBasedStatefulKnowledgeSession.java:156) [drools-core-5.5.0.Final.jar:5.5.0.Final]
              at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:276) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:234) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:329) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.task.event.MessagingTaskEventListener.triggerPayload(MessagingTaskEventListener.java:76) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.task.event.MessagingTaskEventListener.handleEvent(MessagingTaskEventListener.java:92) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:109) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:49) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.task.service.TaskServiceSession.postTaskCompleteOperation(TaskServiceSession.java:569) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:495) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.task.service.local.LocalTaskService.complete(LocalTaskService.java:83) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jbpm.integration.console.TaskManagement.completeTask(TaskManagement.java:101) [jbpm-gwt-core-5.4.0.Final.jar:5.4.0.Final]
              at org.jboss.bpm.console.server.FormProcessingFacade.closeTaskWithUI(FormProcessingFacade.java:172) [classes:]
      
      Show
      Install jBPM 5.4.0 with installer Configure 'Local' in jbpm-gwt-console-server.war/WEB-INF/classes/default.jbpm.console.properties jbpm.console.task.service.strategy=Local Configure LocalHTWorkItemHandler in jbpm-gwt-console-server.war/WEB-INF/classes/default.session.template "Human Task" : "new org.jbpm.process.workitem.wsht.LocalHTWorkItemHandler(taskClient, ksession, org.jbpm.task.utils.OnErrorAction.LOG)" Add "org.jbpm.task" persistence unit in jbpm-gwt-console-server.war/WEB-INF/classes/META-INF/persistence.xml (Also add Taskorm-JPA2.xml) <persistence-unit name="org.jbpm.task" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source> <mapping-file>META-INF/Taskorm-JPA2.xml</mapping-file> <class>org.jbpm.task.Attachment</class> <class>org.jbpm.task.BooleanExpression</class> <class>org.jbpm.task.Comment</class> <class>org.jbpm.task.Content</class> <class>org.jbpm.task.Deadline</class> <class>org.jbpm.task.Delegation</class> <class>org.jbpm.task.EmailNotification</class> <class>org.jbpm.task.EmailNotificationHeader</class> <class>org.jbpm.task.Escalation</class> <class>org.jbpm.task.Group</class> <class>org.jbpm.task.I18NText</class> <class>org.jbpm.task.Notification</class> <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class> <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class> <class>org.jbpm.task.PeopleAssignments</class> <class>org.jbpm.task.Reassignment</class> <class>org.jbpm.task.Status</class> <class>org.jbpm.task.SubTasksStrategy</class> <class>org.jbpm.task.Task</class> <class>org.jbpm.task.TaskData</class> <class>org.jbpm.task.User</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/> <property name="hibernate.max_fetch_depth" value="3"/> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /> <!-- 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" /> </properties> </persistence-unit> Import attached repository_export_rollbacktest.xml via Guvnor Login to jBPM Console as john Start 'rollbacktest' process via jBPM Console Start a Task for john The ScriptTask throws NumberFormatException and the process execution is rolled back. But the Human Task is 'Completed' in the database. 14:09:27,185 ERROR [org.drools.persistence.SingleSessionCommandService] (http-localhost-127.0.0.1-8080-18) Could not commit session: org.jbpm.workflow.instance.WorkflowRuntimeException: [defaultPackage.rollbacktest:2 - ScriptTask:3] -- unable to execute Action: null at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:216) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:196) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:247) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:90) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemAborted(WorkItemNodeInstance.java:301) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:287) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final] at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.abortWorkItem(JPAWorkItemManager.java:154) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:56) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:29) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.abortWorkItem(CommandBasedStatefulKnowledgeSession.java:156) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:276) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:234) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:329) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.task.event.MessagingTaskEventListener.triggerPayload(MessagingTaskEventListener.java:76) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.task.event.MessagingTaskEventListener.handleEvent(MessagingTaskEventListener.java:92) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:109) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:49) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.task.service.TaskServiceSession.postTaskCompleteOperation(TaskServiceSession.java:569) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:495) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.task.service.local.LocalTaskService.complete(LocalTaskService.java:83) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final] at org.jbpm.integration.console.TaskManagement.completeTask(TaskManagement.java:101) [jbpm-gwt-core-5.4.0.Final.jar:5.4.0.Final] at org.jboss.bpm.console.server.FormProcessingFacade.closeTaskWithUI(FormProcessingFacade.java:172) [classes:]
    • Bugzilla Update:
      Perform

      Description

      With jBPM 5.4.0, I can enable LocalTaskService/LocalHTWorkItemHandler (See 'Steps to Reproduce'). But task operation and process execution are not processed in one transaction because the process execution is triggered by TaskServiceSession.postTaskCompleteOperation() after the task operation commit.

      I guess org.jbpm.integration.console.TaskManagement should span a JTA transaction in order to achieve "task operation and process execution in one transaction".

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                swiderski.maciej Maciej Swiderski
                Reporter:
                tkobayashi Toshiya Kobayashi
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: