7 Replies Latest reply on Aug 27, 2011 10:57 AM by salaboy21

    Process flow stops after human task completion in jBPM5.1

    michal.warecki

      Hi,

       

      I have very simple process flow:

      1. Script task: Log "Before"

      2. Human Task

      3. Script task: Log "After"

       

      When I'm running process instance I can see log "Before". Next, I'm starting human task and next completing ( I can see in database that task is in stated "Completed"). Flow stops after human task completion and I can't do anything. There is no exception.

       

      Here are logs from console:

       

      Hibernate: insert into ProcessInstanceInfo (lastModificationDate, lastReadDate, processId, processInstanceByteArray, startDate, state, OPTLOCK) values (?, ?, ?, ?, ?, ?, ?)

      Hibernate: insert into VariableInstanceLog (log_date, processId, processInstanceId, value, variableId, variableInstanceId) values (?, ?, ?, ?, ?, ?)

      Hibernate: insert into ProcessInstanceLog (end_date, processId, processInstanceId, start_date) values (?, ?, ?, ?)

      Hibernate: insert into NodeInstanceLog (log_date, nodeId, nodeInstanceId, nodeName, processId, processInstanceId, type) values (?, ?, ?, ?, ?, ?, ?)

      Hibernate: insert into NodeInstanceLog (log_date, nodeId, nodeInstanceId, nodeName, processId, processInstanceId, type) values (?, ?, ?, ?, ?, ?, ?)

      Hibernate: insert into NodeInstanceLog (log_date, nodeId, nodeInstanceId, nodeName, processId, processInstanceId, type) values (?, ?, ?, ?, ?, ?, ?)

       

      BEFORE

       

      Hibernate: insert into NodeInstanceLog (log_date, nodeId, nodeInstanceId, nodeName, processId, processInstanceId, type) values (?, ?, ?, ?, ?, ?, ?)

      Hibernate: insert into NodeInstanceLog (log_date, nodeId, nodeInstanceId, nodeName, processId, processInstanceId, type) values (?, ?, ?, ?, ?, ?, ?)

      Hibernate: insert into WorkItemInfo (creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray) values (?, ?, ?, ?, ?, ?)

      Hibernate: select user_.id from OrganizationalEntity user_ where user_.id=?

      Hibernate: update WorkItemInfo set creationDate=?, name=?, processInstanceId=?, state=?, OPTLOCK=?, workItemByteArray=? where workItemId=? and OPTLOCK=?

      Hibernate: insert into Task (allowedToDelegate, taskInitiator_id, priority, activationTime, actualOwner_id, createdBy_id, createdOn, documentAccessType, documentContentId, documentType, expirationTime, faultAccessType, faultContentId, faultName, faultType, outputAccessType, outputContentId, outputType, parentId, previousStatus, processInstanceId, skipable, status, workItemId) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

      Hibernate: insert into I18NText (language, text) values (?, ?)

      Hibernate: insert into I18NText (language, text) values (?, ?)

      Hibernate: insert into I18NText (language, text) values (?, ?)

      Hibernate: insert into Content (content) values (?)

      Hibernate: update Task set allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processInstanceId=?, skipable=?, status=?, workItemId=? where id=?

      Hibernate: update I18NText set Task_Descriptions_Id=? where id=?

      Hibernate: update I18NText set Task_Names_Id=? where id=?

      Hibernate: insert into PeopleAssignments_BAs (task_id, entity_id) values (?, ?)

      Hibernate: insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?)

      Hibernate: update I18NText set Task_Subjects_Id=? where id=?

      Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

      Hibernate: update ProcessInstanceInfo set lastModificationDate=?, lastReadDate=?, processId=?, processInstanceByteArray=?, startDate=?, state=?, OPTLOCK=? where InstanceId=? and OPTLOCK=?

      Hibernate: select task0_.id as col_0_0_, task0_.processInstanceId as col_1_0_, names5_.text as col_2_0_, subjects3_.text as col_3_0_, descriptio4_.text as col_4_0_, task0_.status as col_5_0_, task0_.priority as col_6_0_, task0_.skipable as col_7_0_, task0_.actualOwner_id as col_8_0_, task0_.createdBy_id as col_9_0_, task0_.createdOn as col_10_0_, task0_.activationTime as col_11_0_, task0_.expirationTime as col_12_0_ from Task task0_ left outer join OrganizationalEntity user1_ on task0_.createdBy_id=user1_.id left outer join OrganizationalEntity user2_ on task0_.actualOwner_id=user2_.id left outer join I18NText subjects3_ on task0_.id=subjects3_.Task_Subjects_Id left outer join I18NText descriptio4_ on task0_.id=descriptio4_.Task_Descriptions_Id left outer join I18NText names5_ on task0_.id=names5_.Task_Names_Id, OrganizationalEntity organizati6_ where organizati6_.id=? and (organizati6_.id in (select potentialo9_.entity_id from PeopleAssignments_PotOwners potentialo9_ where task0_.id=potentialo9_.task_id)) and (names5_.language=? or (select count(names10_.Task_Names_Id) from I18NText names10_ where task0_.id=names10_.Task_Names_Id)=0) and (subjects3_.language=? or (select count(subjects11_.Task_Subjects_Id) from I18NText subjects11_ where task0_.id=subjects11_.Task_Subjects_Id)=0) and (descriptio4_.language=? or (select count(descriptio12_.Task_Descriptions_Id) from I18NText descriptio12_ where task0_.id=descriptio12_.Task_Descriptions_Id)=0) and (task0_.status in ('Created' , 'Ready' , 'Reserved' , 'InProgress' , 'Suspended')) and (task0_.expirationTime is null)

      Hibernate: select user0_.id as id19_0_ from OrganizationalEntity user0_ where user0_.id=? and user0_.DTYPE='User'

      Hibernate: select task0_.id as id24_3_, task0_.allowedToDelegate as allowedT2_24_3_, task0_.taskInitiator_id as taskIni23_24_3_, task0_.priority as priority24_3_, task0_.activationTime as activati4_24_3_, task0_.actualOwner_id as actualO24_24_3_, task0_.createdBy_id as createdBy25_24_3_, task0_.createdOn as createdOn24_3_, task0_.documentAccessType as document6_24_3_, task0_.documentContentId as document7_24_3_, task0_.documentType as document8_24_3_, task0_.expirationTime as expirati9_24_3_, task0_.faultAccessType as faultAc10_24_3_, task0_.faultContentId as faultCo11_24_3_, task0_.faultName as faultName24_3_, task0_.faultType as faultType24_3_, task0_.outputAccessType as outputA14_24_3_, task0_.outputContentId as outputC15_24_3_, task0_.outputType as outputType24_3_, task0_.parentId as parentId24_3_, task0_.previousStatus as previou18_24_3_, task0_.processInstanceId as process19_24_3_, task0_.skipable as skipable24_3_, task0_.status as status24_3_, task0_.workItemId as workItemId24_3_, user1_.id as id19_0_, user2_.id as id19_1_, user3_.id as id19_2_ from Task task0_ left outer join OrganizationalEntity user1_ on task0_.taskInitiator_id=user1_.id left outer join OrganizationalEntity user2_ on task0_.actualOwner_id=user2_.id left outer join OrganizationalEntity user3_ on task0_.createdBy_id=user3_.id where task0_.id=?

      Hibernate: update Task set allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processInstanceId=?, skipable=?, status=?, workItemId=? where id=?

      Hibernate: select task0_.id as id24_3_, task0_.allowedToDelegate as allowedT2_24_3_, task0_.taskInitiator_id as taskIni23_24_3_, task0_.priority as priority24_3_, task0_.activationTime as activati4_24_3_, task0_.actualOwner_id as actualO24_24_3_, task0_.createdBy_id as createdBy25_24_3_, task0_.createdOn as createdOn24_3_, task0_.documentAccessType as document6_24_3_, task0_.documentContentId as document7_24_3_, task0_.documentType as document8_24_3_, task0_.expirationTime as expirati9_24_3_, task0_.faultAccessType as faultAc10_24_3_, task0_.faultContentId as faultCo11_24_3_, task0_.faultName as faultName24_3_, task0_.faultType as faultType24_3_, task0_.outputAccessType as outputA14_24_3_, task0_.outputContentId as outputC15_24_3_, task0_.outputType as outputType24_3_, task0_.parentId as parentId24_3_, task0_.previousStatus as previou18_24_3_, task0_.processInstanceId as process19_24_3_, task0_.skipable as skipable24_3_, task0_.status as status24_3_, task0_.workItemId as workItemId24_3_, user1_.id as id19_0_, user2_.id as id19_1_, user3_.id as id19_2_ from Task task0_ left outer join OrganizationalEntity user1_ on task0_.taskInitiator_id=user1_.id left outer join OrganizationalEntity user2_ on task0_.actualOwner_id=user2_.id left outer join OrganizationalEntity user3_ on task0_.createdBy_id=user3_.id where task0_.id=?

      Hibernate: select subtaskstr0_.Task_Id as Task4_1_, subtaskstr0_.id as id1_, subtaskstr0_.id as id25_0_, subtaskstr0_.name as name25_0_, subtaskstr0_.DTYPE as DTYPE25_0_ from SubTasksStrategy subtaskstr0_ where subtaskstr0_.Task_Id=?

      Hibernate: update Task set allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processInstanceId=?, skipable=?, status=?, workItemId=? where id=?

      Hibernate: select task0_.id as id24_3_, task0_.allowedToDelegate as allowedT2_24_3_, task0_.taskInitiator_id as taskIni23_24_3_, task0_.priority as priority24_3_, task0_.activationTime as activati4_24_3_, task0_.actualOwner_id as actualO24_24_3_, task0_.createdBy_id as createdBy25_24_3_, task0_.createdOn as createdOn24_3_, task0_.documentAccessType as document6_24_3_, task0_.documentContentId as document7_24_3_, task0_.documentType as document8_24_3_, task0_.expirationTime as expirati9_24_3_, task0_.faultAccessType as faultAc10_24_3_, task0_.faultContentId as faultCo11_24_3_, task0_.faultName as faultName24_3_, task0_.faultType as faultType24_3_, task0_.outputAccessType as outputA14_24_3_, task0_.outputContentId as outputC15_24_3_, task0_.outputType as outputType24_3_, task0_.parentId as parentId24_3_, task0_.previousStatus as previou18_24_3_, task0_.processInstanceId as process19_24_3_, task0_.skipable as skipable24_3_, task0_.status as status24_3_, task0_.workItemId as workItemId24_3_, user1_.id as id19_0_, user2_.id as id19_1_, user3_.id as id19_2_ from Task task0_ left outer join OrganizationalEntity user1_ on task0_.taskInitiator_id=user1_.id left outer join OrganizationalEntity user2_ on task0_.actualOwner_id=user2_.id left outer join OrganizationalEntity user3_ on task0_.createdBy_id=user3_.id where task0_.id=?

      Hibernate: select names0_.Task_Names_Id as Task5_1_, names0_.id as id1_, names0_.id as id20_0_, names0_.language as language20_0_, names0_.text as text20_0_ from I18NText names0_ where names0_.Task_Names_Id=?

      Hibernate: select subjects0_.Task_Subjects_Id as Task4_1_, subjects0_.id as id1_, subjects0_.id as id20_0_, subjects0_.language as language20_0_, subjects0_.text as text20_0_ from I18NText subjects0_ where subjects0_.Task_Subjects_Id=?

      Hibernate: select descriptio0_.Task_Descriptions_Id as Task6_1_, descriptio0_.id as id1_, descriptio0_.id as id20_0_, descriptio0_.language as language20_0_, descriptio0_.text as text20_0_ from I18NText descriptio0_ where descriptio0_.Task_Descriptions_Id=?

      Hibernate: select potentialo0_.task_id as task1_1_, potentialo0_.entity_id as entity2_1_, organizati1_.id as id19_0_, organizati1_.DTYPE as DTYPE19_0_ from PeopleAssignments_PotOwners potentialo0_ left outer join OrganizationalEntity organizati1_ on potentialo0_.entity_id=organizati1_.id where potentialo0_.task_id=?

      Hibernate: select excludedow0_.task_id as task1_1_, excludedow0_.entity_id as entity2_1_, organizati1_.id as id19_0_, organizati1_.DTYPE as DTYPE19_0_ from PeopleAssignments_ExclOwners excludedow0_ left outer join OrganizationalEntity organizati1_ on excludedow0_.entity_id=organizati1_.id where excludedow0_.task_id=?

      Hibernate: select taskstakeh0_.task_id as task1_1_, taskstakeh0_.entity_id as entity2_1_, organizati1_.id as id19_0_, organizati1_.DTYPE as DTYPE19_0_ from PeopleAssignments_Stakeholders taskstakeh0_ left outer join OrganizationalEntity organizati1_ on taskstakeh0_.entity_id=organizati1_.id where taskstakeh0_.task_id=?

      Hibernate: select businessad0_.task_id as task1_1_, businessad0_.entity_id as entity2_1_, organizati1_.id as id19_0_, organizati1_.DTYPE as DTYPE19_0_ from PeopleAssignments_BAs businessad0_ left outer join OrganizationalEntity organizati1_ on businessad0_.entity_id=organizati1_.id where businessad0_.task_id=?

      Hibernate: select recipients0_.task_id as task1_1_, recipients0_.entity_id as entity2_1_, organizati1_.id as id19_0_, organizati1_.DTYPE as DTYPE19_0_ from PeopleAssignments_Recipients recipients0_ left outer join OrganizationalEntity organizati1_ on recipients0_.entity_id=organizati1_.id where recipients0_.task_id=?

      Hibernate: select delegates0_.task_id as task1_1_, delegates0_.entity_id as entity2_1_, organizati1_.id as id19_0_, organizati1_.DTYPE as DTYPE19_0_ from Delegation_delegates delegates0_ left outer join OrganizationalEntity organizati1_ on delegates0_.entity_id=organizati1_.id where delegates0_.task_id=?

      Hibernate: select comments0_.TaskData_Comments_Id as TaskData5_2_, comments0_.id as id2_, comments0_.id as id16_1_, comments0_.addedAt as addedAt16_1_, comments0_.addedBy_id as addedBy4_16_1_, comments0_.text as text16_1_, user1_.id as id19_0_ from task_comment comments0_ left outer join OrganizationalEntity user1_ on comments0_.addedBy_id=user1_.id where comments0_.TaskData_Comments_Id=?

      Hibernate: select attachment0_.TaskData_Attachments_Id as TaskData9_2_, attachment0_.id as id2_, attachment0_.id as id13_1_, attachment0_.accessType as accessType13_1_, attachment0_.attachedAt as attachedAt13_1_, attachment0_.attachedBy_id as attachedBy8_13_1_, attachment0_.attachmentContentId as attachme4_13_1_, attachment0_.contentType as contentT5_13_1_, attachment0_.name as name13_1_, attachment0_.attachment_size as attachment7_13_1_, user1_.id as id19_0_ from Attachment attachment0_ left outer join OrganizationalEntity user1_ on attachment0_.attachedBy_id=user1_.id where attachment0_.TaskData_Attachments_Id=?

      Hibernate: select startdeadl0_.Deadlines_StartDeadLine_Id as Deadlines4_1_, startdeadl0_.id as id1_, startdeadl0_.id as id17_0_, startdeadl0_.deadline_date as deadline2_17_0_, startdeadl0_.escalated as escalated17_0_ from Deadline startdeadl0_ where startdeadl0_.Deadlines_StartDeadLine_Id=?

      Hibernate: select enddeadlin0_.Deadlines_EndDeadLine_Id as Deadlines5_1_, enddeadlin0_.id as id1_, enddeadlin0_.id as id17_0_, enddeadlin0_.deadline_date as deadline2_17_0_, enddeadlin0_.escalated as escalated17_0_ from Deadline enddeadlin0_ where enddeadlin0_.Deadlines_EndDeadLine_Id=?

      Hibernate: select subtaskstr0_.Task_Id as Task4_1_, subtaskstr0_.id as id1_, subtaskstr0_.id as id25_0_, subtaskstr0_.name as name25_0_, subtaskstr0_.DTYPE as DTYPE25_0_ from SubTasksStrategy subtaskstr0_ where subtaskstr0_.Task_Id=?

       

       

      What could be the reason of such behaviour?

        • 1. Re: Process flow stops after human task completion in jBPM5.1
          salaboy21

          You didn't attach the right listener to the session that is notified when a task is completed to signal the process to the next activity.

          Cheers

          • 2. Re: Process flow stops after human task completion in jBPM5.1
            michal.warecki

            Wow, that's right but I attach listener like in documentation:

             

            SystemEventListener systemEventListener = org.drools.SystemEventListenerFactory.getSystemEventListener();

             

            Exacly in my case in Spring way:

             

            <bean id="systemEventListener"

                    class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">

                    <property name="staticMethod">

                        <value>org.drools.SystemEventListenerFactory.getSystemEventListener</value>

                    </property>

                </bean>

             

            In debug I can see that systemEventListener is org.drools.core.util.DelegatingSystemEventListener and has listener property org.drools.agent.impl.DoNothingSystemEventListener so DoNothing is not what I want to attach :-)

             

            How can I get right listener?

            • 3. Re: Process flow stops after human task completion in jBPM5.1
              salaboy21

              That's a system wide generic listener.

              You should register a WorkItemHandler that is in charge of creating the tasks when the processes reaches a userTask activity and also that attach the listeners to the session to be able to continue the process when a human task is created. I assume that you have something like:

              ksession.getWorkItemManager().registerWorkItemHandler("Human Task", ... );

              Right? that line attach the listener related with Human Tasks. You should set the appropriate handler for your Human Task Server.

              Can you share that configuration and also specify which transport are you using?

              Cheers

              • 4. Re: Process flow stops after human task completion in jBPM5.1
                michal.warecki

                Yes, I register this handler.

                Here is my configuration:

                 

                 

                <bean id="systemEventListener"
                        class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
                        <property name="staticMethod">
                            <value>org.drools.SystemEventListenerFactory.getSystemEventListener</value>
                        </property>
                    </bean>
                
                    <bean id="taskService" class="org.jbpm.task.service.TaskService">
                        <constructor-arg ref="taskEntityManagerFactory" />
                        <constructor-arg ref="systemEventListener" />
                    </bean>
                
                    <bean id="taskSession" class="org.jbpm.task.service.TaskServiceSession"
                        factory-bean="taskService" factory-method="createSession" scope="singleton" >
                    </bean>
                
                    <bean id="taskExecutor"
                        class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
                        <property name="corePoolSize" value="5" />
                        <property name="maxPoolSize" value="10" />
                        <property name="queueCapacity" value="25" />
                    </bean>
                
                    <bean id="minaTaskServer" class="org.jbpm.task.service.mina.MinaTaskServer">
                        <constructor-arg ref="taskService" />
                    </bean>
                
                    <bean id="taskServerThread" class="pl.edu.wat.mw.task.server.TaskServer"
                        p:taskExecutor-ref="taskExecutor" p:minaTaskServer-ref="minaTaskServer"
                        init-method="startServer" destroy-method="stopServer" lazy-init="false" />
                
                    <bean id="knowledgeSessionFactory" class="pl.edu.wat.mw.process.session.KnowledgeSessionFactory" 
                        p:entityManagerFactory-ref="processEntityManagerFactory"
                        p:transactionManager-ref="transactionManager" />
                    
                    <bean id="knowledgeSession" class="org.drools.runtime.StatefulKnowledgeSession" 
                        factory-bean="knowledgeSessionFactory" 
                        factory-method="createSession"/>
                
                    <bean id="taskClientFactory" class="pl.edu.wat.mw.task.service.TaskClientFactory" />
                        
                    <bean id="taskClient" class="org.jbpm.task.service.TaskClient" 
                        factory-bean="taskClientFactory"
                        factory-method="factory"
                        scope="singleton"
                        lazy-init="true" 
                    />
                

                 

                 

                Where in KnowledgeSessionFactory I have:

                 

                 

                public void afterPropertiesSet() {
                        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
                        kbuilder.add(ResourceFactory.newClassPathResource("process/pl.edu.wat.mw.RetailSales.bpmn2"), ResourceType.BPMN2);
                        kbase = kbuilder.newKnowledgeBase();
                        
                        env = KnowledgeBaseFactory.newEnvironment();
                        env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, entityManagerFactory);
                        env.set(EnvironmentName.TRANSACTION_MANAGER, transactionManager);
                    }
                    
                    public StatefulKnowledgeSession createSession() {
                        // create a new knowledge session that uses JPA to store the runtime state
                        StatefulKnowledgeSession ksession =
                            JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
                        
                        JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);
                        
                        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());
                        ksession.getWorkItemManager().registerWorkItemHandler("WSInvoke", serviceInvokerWorkItem);
                        ksession.getWorkItemManager().registerWorkItemHandler("CreateOrderProfile", createOrderProfileWorkItem);
                        
                        logger.dispose();
                        return ksession;
                    }
                

                 

                In TaskClientFactory:

                 

                public TaskClient factory() {
                        TaskClient client = new TaskClient(new MinaTaskClientConnector("default client", new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
                        return client;
                    }
                

                 

                 

                I have a feeling that I broke something in Spring configuration :-)

                • 5. Re: Process flow stops after human task completion in jBPM5.1
                  salaboy21

                  If you are using the JPAKnowledgeService you should be using this:

                   

                   

                   ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new CommandBasedWSHumanTaskHandler());

                   

                  Instead of this:

                   

                   

                   ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());

                   

                  Cheers

                  • 6. Re: Process flow stops after human task completion in jBPM5.1
                    michal.warecki

                    That's right! Is this difference from jbpm 5.0? I Made some medium project in jbpm 5.0 and I was using WSHumanTaskHandler and everything worked fine with JPA.

                     

                    Thanks!

                    • 7. Re: Process flow stops after human task completion in jBPM5.1
                      salaboy21

                      Great.. if you are using snapshots stay tuned, because I've introduced  couple of new implementations for each particular transport. adding the name of the transport in the handler to be clear about which implementation are you using. Cheers

                      PS: Thanks for marking the question as answered!