5 Replies Latest reply on Aug 26, 2015 2:44 AM by Maulee Parikh

    New process instance created but no task insert in db

    joploya Newbie

      Hello,

       

      I have a persistent session. When the process starts, the log shows that session is created, process variables are passed to the process instance. Also the workitem is created well. But no task appears or is created. I have no "bug" or error in my log and until today I didn't encounter this kind of problem.

       

      This is the log. I don't understand what is "AFTER PROCESS NODE TRIGGERED"

       

       

      11:52:01,222 INFO  [stdout] (http--0.0.0.0-8080-7) knowledge base NOT null
      
      
      11:52:01,223 INFO  [stdout] (http--0.0.0.0-8080-7)  - process newcpbeforem29commontrunk [com.st.ams.flows.newcpbeforem29commontrunk]
      
      
      11:52:01,224 INFO  [stdout] (http--0.0.0.0-8080-7)  - process newcpbeforem29 [com.st.ams.flows.newcpbeforem29]
      
      
      11:52:01,224 INFO  [stdout] (http--0.0.0.0-8080-7)  - process newfrontendcodes [com.st.ams.flows.nfep]
      
      
      11:52:01,224 INFO  [stdout] (http--0.0.0.0-8080-7)  - process newfinishedgood [com.st.ams.flows.newfinishedgood]
      
      
      11:52:01,225 INFO  [stdout] (http--0.0.0.0-8080-7)  - process DataCorrections [com.st.ams.flows.datacorrections]
      
      
      11:52:01,225 INFO  [stdout] (http--0.0.0.0-8080-7)  - process newproductline [com.st.ams.flows.newproductline]
      
      
      11:52:01,227 INFO  [stdout] (http--0.0.0.0-8080-7) Hibernate: 
      11:52:01,228 INFO  [stdout] (http--0.0.0.0-8080-7)     select
      11:52:01,228 INFO  [stdout] (http--0.0.0.0-8080-7)         knowledges0_.sessionId as sessionId417_ 
      11:52:01,228 INFO  [stdout] (http--0.0.0.0-8080-7)     from
      11:52:01,229 INFO  [stdout] (http--0.0.0.0-8080-7)         KnowledgeSessionRecovery knowledges0_
      
      
      11:52:02,299 INFO  [stdout] (http--0.0.0.0-8080-7) Hibernate: 
      11:52:02,299 INFO  [stdout] (http--0.0.0.0-8080-7)     insert 
      11:52:02,299 INFO  [stdout] (http--0.0.0.0-8080-7)     into
      11:52:02,299 INFO  [stdout] (http--0.0.0.0-8080-7)         SessionInfo
      11:52:02,300 INFO  [stdout] (http--0.0.0.0-8080-7)         (lastModificationDate, rulesByteArray, startDate, OPTLOCK) 
      11:52:02,300 INFO  [stdout] (http--0.0.0.0-8080-7)     values
      11:52:02,300 INFO  [stdout] (http--0.0.0.0-8080-7)         (?, ?, ?, ?)
      
      
      11:52:02,305 INFO  [stdout] (http--0.0.0.0-8080-7) Hibernate: 
      11:52:02,305 INFO  [stdout] (http--0.0.0.0-8080-7)     select
      11:52:02,306 INFO  [stdout] (http--0.0.0.0-8080-7)         knowledges0_.sessionId as sessionId417_0_ 
      11:52:02,306 INFO  [stdout] (http--0.0.0.0-8080-7)     from
      11:52:02,306 INFO  [stdout] (http--0.0.0.0-8080-7)         KnowledgeSessionRecovery knowledges0_ 
      11:52:02,306 INFO  [stdout] (http--0.0.0.0-8080-7)     where
      11:52:02,307 INFO  [stdout] (http--0.0.0.0-8080-7)         knowledges0_.sessionId=?
      
      
      11:52:02,308 INFO  [stdout] (http--0.0.0.0-8080-7)  !!!! DEBUG SESSION PERSISTENCE : new session with id : 1 !!!!
      
      
      11:52:02,330 INFO  [stdout] (http--0.0.0.0-8080-7) Hibernate: 
      11:52:02,331 INFO  [stdout] (http--0.0.0.0-8080-7)     insert 
      11:52:02,331 INFO  [stdout] (http--0.0.0.0-8080-7)     into
      11:52:02,331 INFO  [stdout] (http--0.0.0.0-8080-7)         KnowledgeSessionRecovery
      11:52:02,331 INFO  [stdout] (http--0.0.0.0-8080-7)         (sessionId) 
      11:52:02,332 INFO  [stdout] (http--0.0.0.0-8080-7)     values
      11:52:02,332 INFO  [stdout] (http--0.0.0.0-8080-7)         (?)
      
      
      11:52:02,352 INFO  [stdout] (http--0.0.0.0-8080-7) Hibernate: 
      11:52:02,353 INFO  [stdout] (http--0.0.0.0-8080-7)     insert 
      11:52:02,353 INFO  [stdout] (http--0.0.0.0-8080-7)     into
      11:52:02,353 INFO  [stdout] (http--0.0.0.0-8080-7)         ProcessInstanceInfo
      11:52:02,353 INFO  [stdout] (http--0.0.0.0-8080-7)         (OPTLOCK, processId, startDate, lastReadDate, lastModificationDate, state, processInstanceByteArray) 
      11:52:02,354 INFO  [stdout] (http--0.0.0.0-8080-7)     values
      11:52:02,354 INFO  [stdout] (http--0.0.0.0-8080-7)         (?, ?, ?, ?, ?, ?, ?)
      
      
      11:52:02,362 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) BEFORE RULEFLOW VARIABLE CHANGED startDate=Mon Jun 24 11:51:53 CEST 2013 process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,363 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) AFTER RULEFLOW VARIABLE CHANGED startDate=Mon Jun 24 11:51:53 CEST 2013 process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,364 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) BEFORE RULEFLOW VARIABLE CHANGED flowType=N_FG process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,365 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) AFTER RULEFLOW VARIABLE CHANGED flowType=N_FG process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,379 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) BEFORE RULEFLOW VARIABLE CHANGED flowId=1 process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,380 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) AFTER RULEFLOW VARIABLE CHANGED flowId=1 process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,383 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) BEFORE RULEFLOW STARTED process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,393 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) BEFORE PROCESS NODE TRIGGERED node:[id=1] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,394 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) BEFORE PROCESS NODE EXITED node:[id=1] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,395 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) BEFORE PROCESS NODE TRIGGERED node:[id=2] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,399 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) BEFORE PROCESS NODE EXITED node:[id=2] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,399 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) BEFORE PROCESS NODE TRIGGERED node:P_ENG_step[id=3] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:02,401 INFO  [stdout] (http--0.0.0.0-8080-7) Hibernate: 
      11:52:02,402 INFO  [stdout] (http--0.0.0.0-8080-7)     insert 
      11:52:02,402 INFO  [stdout] (http--0.0.0.0-8080-7)     into
      11:52:02,402 INFO  [stdout] (http--0.0.0.0-8080-7)         WorkItemInfo
      11:52:02,402 INFO  [stdout] (http--0.0.0.0-8080-7)         (creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray) 
      11:52:02,403 INFO  [stdout] (http--0.0.0.0-8080-7)     values
      11:52:02,403 INFO  [stdout] (http--0.0.0.0-8080-7)         (?, ?, ?, ?, ?, ?)
      
      
      11:52:03,177 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) AFTER PROCESS NODE TRIGGERED node:P_ENG_step[id=3] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:03,178 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) AFTER PROCESS NODE TRIGGERED node:[id=2] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:03,178 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) AFTER PROCESS NODE TRIGGERED node:[id=2] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:03,179 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) AFTER PROCESS NODE TRIGGERED node:[id=1] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:03,180 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) AFTER PROCESS NODE TRIGGERED node:[id=1] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:03,180 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-7) AFTER RULEFLOW STARTED process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]
      11:52:03,183 INFO  [stdout] (http--0.0.0.0-8080-7) Hibernate: 
      11:52:03,183 INFO  [stdout] (http--0.0.0.0-8080-7)     update
      11:52:03,183 INFO  [stdout] (http--0.0.0.0-8080-7)         SessionInfo 
      11:52:03,183 INFO  [stdout] (http--0.0.0.0-8080-7)     set
      11:52:03,183 INFO  [stdout] (http--0.0.0.0-8080-7)         lastModificationDate=?,
      11:52:03,184 INFO  [stdout] (http--0.0.0.0-8080-7)         rulesByteArray=?,
      11:52:03,184 INFO  [stdout] (http--0.0.0.0-8080-7)         startDate=?,
      11:52:03,184 INFO  [stdout] (http--0.0.0.0-8080-7)         OPTLOCK=? 
      11:52:03,184 INFO  [stdout] (http--0.0.0.0-8080-7)     where
      11:52:03,184 INFO  [stdout] (http--0.0.0.0-8080-7)         id=? 
      11:52:03,185 INFO  [stdout] (http--0.0.0.0-8080-7)         and OPTLOCK=?
      
      
      11:52:03,199 INFO  [stdout] (http--0.0.0.0-8080-7) Hibernate: 
      11:52:03,200 INFO  [stdout] (http--0.0.0.0-8080-7)     update
      11:52:03,200 INFO  [stdout] (http--0.0.0.0-8080-7)         ProcessInstanceInfo 
      11:52:03,200 INFO  [stdout] (http--0.0.0.0-8080-7)     set
      11:52:03,200 INFO  [stdout] (http--0.0.0.0-8080-7)         OPTLOCK=?,
      11:52:03,201 INFO  [stdout] (http--0.0.0.0-8080-7)         processId=?,
      11:52:03,201 INFO  [stdout] (http--0.0.0.0-8080-7)         startDate=?,
      11:52:03,201 INFO  [stdout] (http--0.0.0.0-8080-7)         lastReadDate=?,
      11:52:03,201 INFO  [stdout] (http--0.0.0.0-8080-7)         lastModificationDate=?,
      11:52:03,202 INFO  [stdout] (http--0.0.0.0-8080-7)         state=?,
      11:52:03,202 INFO  [stdout] (http--0.0.0.0-8080-7)         processInstanceByteArray=? 
      11:52:03,202 INFO  [stdout] (http--0.0.0.0-8080-7)     where
      11:52:03,202 INFO  [stdout] (http--0.0.0.0-8080-7)         InstanceId=? 
      11:52:03,203 INFO  [stdout] (http--0.0.0.0-8080-7)         and OPTLOCK=?
      
      
      11:52:03,204 INFO  [stdout] (http--0.0.0.0-8080-7) Hibernate: 
      11:52:03,204 INFO  [stdout] (http--0.0.0.0-8080-7)     update
      11:52:03,204 INFO  [stdout] (http--0.0.0.0-8080-7)         WorkItemInfo 
      11:52:03,205 INFO  [stdout] (http--0.0.0.0-8080-7)     set
      11:52:03,205 INFO  [stdout] (http--0.0.0.0-8080-7)         creationDate=?,
      11:52:03,205 INFO  [stdout] (http--0.0.0.0-8080-7)         name=?,
      11:52:03,206 INFO  [stdout] (http--0.0.0.0-8080-7)         processInstanceId=?,
      11:52:03,206 INFO  [stdout] (http--0.0.0.0-8080-7)         state=?,
      11:52:03,206 INFO  [stdout] (http--0.0.0.0-8080-7)         OPTLOCK=?,
      11:52:03,206 INFO  [stdout] (http--0.0.0.0-8080-7)         workItemByteArray=? 
      11:52:03,206 INFO  [stdout] (http--0.0.0.0-8080-7)     where
      11:52:03,207 INFO  [stdout] (http--0.0.0.0-8080-7)         workItemId=? 
      11:52:03,207 INFO  [stdout] (http--0.0.0.0-8080-7)         and OPTLOCK=?
      
      

       

      Thanks for any explanation.

       

      I'm on Jbpm 5.4 with mySQL.

        • 1. Re: New process instance created but no task insert in db
          joploya Newbie

          Total enigma : I try to start again a new instance of process using the debugging mode and... it works without any change.

           

          I don't see any change in logs exept for sql requests that insert the new task.

           

          13:55:51,853 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:51,855 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:51,858 INFO  [stdout] (http--0.0.0.0-8080-4)         ProcessInstanceInfo

          13:55:51,861 INFO  [stdout] (http--0.0.0.0-8080-4)         (OPTLOCK, processId, startDate, lastReadDate, lastModificationDate, state, processInstanceByteArray)

          13:55:51,864 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:51,865 INFO  [stdout] (http--0.0.0.0-8080-4)         (?, ?, ?, ?, ?, ?, ?)

           

           

          13:55:51,876 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) BEFORE RULEFLOW VARIABLE CHANGED startDate=Mon Jun 24 13:54:07 CEST 2013 process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,879 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) AFTER RULEFLOW VARIABLE CHANGED startDate=Mon Jun 24 13:54:07 CEST 2013 process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,882 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) BEFORE RULEFLOW VARIABLE CHANGED flowType=N_FG process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,885 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) AFTER RULEFLOW VARIABLE CHANGED flowType=N_FG process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,934 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) BEFORE RULEFLOW VARIABLE CHANGED flowId=2 process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,936 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) AFTER RULEFLOW VARIABLE CHANGED flowId=2 process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,938 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) BEFORE RULEFLOW STARTED process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,940 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) BEFORE PROCESS NODE TRIGGERED node:[id=1] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,942 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) BEFORE PROCESS NODE EXITED node:[id=1] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,943 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) BEFORE PROCESS NODE TRIGGERED node:[id=2] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,945 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) BEFORE PROCESS NODE EXITED node:[id=2] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,947 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) BEFORE PROCESS NODE TRIGGERED node:P_ENG_step[id=3] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:51,955 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:51,956 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:51,957 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:51,958 INFO  [stdout] (http--0.0.0.0-8080-4)         WorkItemInfo

          13:55:51,959 INFO  [stdout] (http--0.0.0.0-8080-4)         (creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray)

          13:55:51,960 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:51,961 INFO  [stdout] (http--0.0.0.0-8080-4)         (?, ?, ?, ?, ?, ?)

           

           

          13:55:52,029 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,030 INFO  [stdout] (http--0.0.0.0-8080-4)     select

          13:55:52,031 INFO  [stdout] (http--0.0.0.0-8080-4)         user0_.id as id402_0_

          13:55:52,032 INFO  [stdout] (http--0.0.0.0-8080-4)     from

          13:55:52,033 INFO  [stdout] (http--0.0.0.0-8080-4)         OrganizationalEntity user0_

          13:55:52,034 INFO  [stdout] (http--0.0.0.0-8080-4)     where

          13:55:52,035 INFO  [stdout] (http--0.0.0.0-8080-4)         user0_.id=?

          13:55:52,036 INFO  [stdout] (http--0.0.0.0-8080-4)         and user0_.DTYPE='User'

           

           

          13:55:52,041 DEBUG [com.st.ams.task.management.AMSUserGroupCallbackImpl] (http--0.0.0.0-8080-4) Seaching for user existence with filter NATHALIE BANCHERI

          13:55:52,279 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,282 INFO  [stdout] (http--0.0.0.0-8080-4)     select

          13:55:52,284 INFO  [stdout] (http--0.0.0.0-8080-4)         user0_.id as id402_0_

          13:55:52,287 INFO  [stdout] (http--0.0.0.0-8080-4)     from

          13:55:52,289 INFO  [stdout] (http--0.0.0.0-8080-4)         OrganizationalEntity user0_

          13:55:52,291 INFO  [stdout] (http--0.0.0.0-8080-4)     where

          13:55:52,293 INFO  [stdout] (http--0.0.0.0-8080-4)         user0_.id=?

          13:55:52,295 INFO  [stdout] (http--0.0.0.0-8080-4)         and user0_.DTYPE='User'

           

           

          13:55:52,301 DEBUG [com.st.ams.task.management.AMSUserGroupCallbackImpl] (http--0.0.0.0-8080-4) Seaching for group existence with filter AMS_CRW_ANALOG_P_ENG

          13:55:52,348 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,349 INFO  [stdout] (http--0.0.0.0-8080-4)     select

          13:55:52,350 INFO  [stdout] (http--0.0.0.0-8080-4)         group0_.id as id402_0_

          13:55:52,351 INFO  [stdout] (http--0.0.0.0-8080-4)     from

          13:55:52,353 INFO  [stdout] (http--0.0.0.0-8080-4)         OrganizationalEntity group0_

          13:55:52,354 INFO  [stdout] (http--0.0.0.0-8080-4)     where

          13:55:52,355 INFO  [stdout] (http--0.0.0.0-8080-4)         group0_.id=?

          13:55:52,356 INFO  [stdout] (http--0.0.0.0-8080-4)         and group0_.DTYPE='Group'

           

           

          13:55:52,360 DEBUG [com.st.ams.task.management.AMSUserGroupCallbackImpl] (http--0.0.0.0-8080-4) Seaching for group existence with filter AMS_CRW_ADMIN

          13:55:52,490 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,493 INFO  [stdout] (http--0.0.0.0-8080-4)     select

          13:55:52,495 INFO  [stdout] (http--0.0.0.0-8080-4)         group0_.id as id402_0_

          13:55:52,497 INFO  [stdout] (http--0.0.0.0-8080-4)     from

          13:55:52,498 INFO  [stdout] (http--0.0.0.0-8080-4)         OrganizationalEntity group0_

          13:55:52,500 INFO  [stdout] (http--0.0.0.0-8080-4)     where

          13:55:52,502 INFO  [stdout] (http--0.0.0.0-8080-4)         group0_.id=?

          13:55:52,504 INFO  [stdout] (http--0.0.0.0-8080-4)         and group0_.DTYPE='Group'

           

           

          13:55:52,509 DEBUG [com.st.ams.task.management.AMSUserGroupCallbackImpl] (http--0.0.0.0-8080-4) Seaching for user existence with filter NATHALIE BANCHERI

          13:55:52,704 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,706 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:52,707 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:52,709 INFO  [stdout] (http--0.0.0.0-8080-4)         OrganizationalEntity

          13:55:52,710 INFO  [stdout] (http--0.0.0.0-8080-4)         (DTYPE, id)

          13:55:52,712 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:52,713 INFO  [stdout] (http--0.0.0.0-8080-4)         ('User', ?)

           

           

          13:55:52,721 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,722 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:52,724 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:52,725 INFO  [stdout] (http--0.0.0.0-8080-4)         OrganizationalEntity

          13:55:52,726 INFO  [stdout] (http--0.0.0.0-8080-4)         (DTYPE, id)

          13:55:52,728 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:52,729 INFO  [stdout] (http--0.0.0.0-8080-4)         ('User', ?)

           

           

          13:55:52,735 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,736 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:52,737 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:52,738 INFO  [stdout] (http--0.0.0.0-8080-4)         OrganizationalEntity

          13:55:52,739 INFO  [stdout] (http--0.0.0.0-8080-4)         (DTYPE, id)

          13:55:52,739 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:52,740 INFO  [stdout] (http--0.0.0.0-8080-4)         ('Group', ?)

           

           

          13:55:52,745 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,746 INFO  [stdout] (http--0.0.0.0-8080-4)     select

          13:55:52,747 INFO  [stdout] (http--0.0.0.0-8080-4)         user_.id

          13:55:52,748 INFO  [stdout] (http--0.0.0.0-8080-4)     from

          13:55:52,749 INFO  [stdout] (http--0.0.0.0-8080-4)         OrganizationalEntity user_

          13:55:52,750 INFO  [stdout] (http--0.0.0.0-8080-4)     where

          13:55:52,751 INFO  [stdout] (http--0.0.0.0-8080-4)         user_.id=?

           

           

          13:55:52,769 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,770 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:52,771 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:52,772 INFO  [stdout] (http--0.0.0.0-8080-4)         Task

          13:55:52,772 INFO  [stdout] (http--0.0.0.0-8080-4)         (archived, allowedToDelegate, taskInitiator_id, priority, activationTime, actualOwner_id, completedOn, createdBy_id, createdOn, documentAccessType, documentContentId, documentType, expirationTime, faultAccessType, faultContentId, faultName, faultType, outputAccessType, outputContentId, outputType, parentId, previousStatus, processId, processInstanceId, processSessionId, skipable, status, workItemId, OPTLOCK)

          13:55:52,776 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:52,777 INFO  [stdout] (http--0.0.0.0-8080-4)         (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

           

           

          13:55:52,793 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,794 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:52,794 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:52,795 INFO  [stdout] (http--0.0.0.0-8080-4)         I18NText

          13:55:52,796 INFO  [stdout] (http--0.0.0.0-8080-4)         (language, shortText, text)

          13:55:52,797 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:52,798 INFO  [stdout] (http--0.0.0.0-8080-4)         (?, ?, ?)

           

           

          13:55:52,811 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,812 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:52,813 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:52,814 INFO  [stdout] (http--0.0.0.0-8080-4)         I18NText

          13:55:52,815 INFO  [stdout] (http--0.0.0.0-8080-4)         (language, shortText, text)

          13:55:52,816 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:52,817 INFO  [stdout] (http--0.0.0.0-8080-4)         (?, ?, ?)

           

           

          13:55:52,823 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,825 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:52,826 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:52,827 INFO  [stdout] (http--0.0.0.0-8080-4)         I18NText

          13:55:52,828 INFO  [stdout] (http--0.0.0.0-8080-4)         (language, shortText, text)

          13:55:52,829 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:52,830 INFO  [stdout] (http--0.0.0.0-8080-4)         (?, ?, ?)

           

           

          13:55:52,836 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,837 INFO  [stdout] (http--0.0.0.0-8080-4)     insert

          13:55:52,837 INFO  [stdout] (http--0.0.0.0-8080-4)     into

          13:55:52,838 INFO  [stdout] (http--0.0.0.0-8080-4)         Content

          13:55:52,839 INFO  [stdout] (http--0.0.0.0-8080-4)         (content)

          13:55:52,840 INFO  [stdout] (http--0.0.0.0-8080-4)     values

          13:55:52,840 INFO  [stdout] (http--0.0.0.0-8080-4)         (?)

           

           

          13:55:52,854 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) AFTER PROCESS NODE TRIGGERED node:P_ENG_step[id=3] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:52,856 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) AFTER PROCESS NODE TRIGGERED node:[id=2] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:52,857 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) AFTER PROCESS NODE TRIGGERED node:[id=2] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:52,859 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) AFTER PROCESS NODE TRIGGERED node:[id=1] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:52,861 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) AFTER PROCESS NODE TRIGGERED node:[id=1] process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:52,863 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (http--0.0.0.0-8080-4) AFTER RULEFLOW STARTED process:newfinishedgood[id=com.st.ams.flows.newfinishedgood]

          13:55:52,870 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,871 INFO  [stdout] (http--0.0.0.0-8080-4)     update

          13:55:52,871 INFO  [stdout] (http--0.0.0.0-8080-4)         SessionInfo

          13:55:52,872 INFO  [stdout] (http--0.0.0.0-8080-4)     set

          13:55:52,873 INFO  [stdout] (http--0.0.0.0-8080-4)         lastModificationDate=?,

          13:55:52,874 INFO  [stdout] (http--0.0.0.0-8080-4)         rulesByteArray=?,

          13:55:52,875 INFO  [stdout] (http--0.0.0.0-8080-4)         startDate=?,

          13:55:52,876 INFO  [stdout] (http--0.0.0.0-8080-4)         OPTLOCK=?

          13:55:52,877 INFO  [stdout] (http--0.0.0.0-8080-4)     where

          13:55:52,878 INFO  [stdout] (http--0.0.0.0-8080-4)         id=?

          13:55:52,878 INFO  [stdout] (http--0.0.0.0-8080-4)         and OPTLOCK=?

           

           

          13:55:52,902 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,903 INFO  [stdout] (http--0.0.0.0-8080-4)     update

          13:55:52,903 INFO  [stdout] (http--0.0.0.0-8080-4)         ProcessInstanceInfo

          13:55:52,904 INFO  [stdout] (http--0.0.0.0-8080-4)     set

          13:55:52,905 INFO  [stdout] (http--0.0.0.0-8080-4)         OPTLOCK=?,

          13:55:52,906 INFO  [stdout] (http--0.0.0.0-8080-4)         processId=?,

          13:55:52,907 INFO  [stdout] (http--0.0.0.0-8080-4)         startDate=?,

          13:55:52,908 INFO  [stdout] (http--0.0.0.0-8080-4)         lastReadDate=?,

          13:55:52,909 INFO  [stdout] (http--0.0.0.0-8080-4)         lastModificationDate=?,

          13:55:52,910 INFO  [stdout] (http--0.0.0.0-8080-4)         state=?,

          13:55:52,911 INFO  [stdout] (http--0.0.0.0-8080-4)         processInstanceByteArray=?

          13:55:52,912 INFO  [stdout] (http--0.0.0.0-8080-4)     where

          13:55:52,913 INFO  [stdout] (http--0.0.0.0-8080-4)         InstanceId=?

          13:55:52,913 INFO  [stdout] (http--0.0.0.0-8080-4)         and OPTLOCK=?

           

           

          13:55:52,921 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,922 INFO  [stdout] (http--0.0.0.0-8080-4)     update

          13:55:52,923 INFO  [stdout] (http--0.0.0.0-8080-4)         WorkItemInfo

          13:55:52,924 INFO  [stdout] (http--0.0.0.0-8080-4)     set

          13:55:52,924 INFO  [stdout] (http--0.0.0.0-8080-4)         creationDate=?,

          13:55:52,925 INFO  [stdout] (http--0.0.0.0-8080-4)         name=?,

          13:55:52,926 INFO  [stdout] (http--0.0.0.0-8080-4)         processInstanceId=?,

          13:55:52,927 INFO  [stdout] (http--0.0.0.0-8080-4)         state=?,

          13:55:52,928 INFO  [stdout] (http--0.0.0.0-8080-4)         OPTLOCK=?,

          13:55:52,929 INFO  [stdout] (http--0.0.0.0-8080-4)         workItemByteArray=?

          13:55:52,930 INFO  [stdout] (http--0.0.0.0-8080-4)     where

          13:55:52,930 INFO  [stdout] (http--0.0.0.0-8080-4)         workItemId=?

          13:55:52,931 INFO  [stdout] (http--0.0.0.0-8080-4)         and OPTLOCK=?

           

           

          13:55:52,949 INFO  [stdout] (http--0.0.0.0-8080-4) Hibernate:

          13:55:52,950 INFO  [stdout] (http--0.0.0.0-8080-4)     update

          13:55:52,951 INFO  [stdout] (http--0.0.0.0-8080-4)         Task

          13:55:52,952 INFO  [stdout] (http--0.0.0.0-8080-4)     set

          13:55:52,953 INFO  [stdout] (http--0.0.0.0-8080-4)         archived=?,

          13:55:52,954 INFO  [stdout] (http--0.0.0.0-8080-4)         allowedToDelegate=?,

          13:55:52,955 INFO  [stdout] (http--0.0.0.0-8080-4)         taskInitiator_id=?,

          13:55:52,956 INFO  [stdout] (http--0.0.0.0-8080-4)         priority=?,

          13:55:52,957 INFO  [stdout] (http--0.0.0.0-8080-4)         activationTime=?,

          13:55:52,958 INFO  [stdout] (http--0.0.0.0-8080-4)         actualOwner_id=?,

          13:55:52,959 INFO  [stdout] (http--0.0.0.0-8080-4)         completedOn=?,

          13:55:52,960 INFO  [stdout] (http--0.0.0.0-8080-4)         createdBy_id=?,

          13:55:52,961 INFO  [stdout] (http--0.0.0.0-8080-4)         createdOn=?,

          13:55:52,962 INFO  [stdout] (http--0.0.0.0-8080-4)         documentAccessType=?,

          13:55:52,963 INFO  [stdout] (http--0.0.0.0-8080-4)         documentContentId=?,

          13:55:52,964 INFO  [stdout] (http--0.0.0.0-8080-4)         documentType=?,

          13:55:52,965 INFO  [stdout] (http--0.0.0.0-8080-4)         expirationTime=?,

          13:55:52,966 INFO  [stdout] (http--0.0.0.0-8080-4)         faultAccessType=?,

          13:55:52,967 INFO  [stdout] (http--0.0.0.0-8080-4)         faultContentId=?,

          13:55:52,968 INFO  [stdout] (http--0.0.0.0-8080-4)         faultName=?,

          13:55:52,969 INFO  [stdout] (http--0.0.0.0-8080-4)         faultType=?,

          13:55:52,970 INFO  [stdout] (http--0.0.0.0-8080-4)         outputAccessType=?,

          13:55:52,971 INFO  [stdout] (http--0.0.0.0-8080-4)         outputContentId=?,

          13:55:52,972 INFO  [stdout] (http--0.0.0.0-8080-4)         outputType=?,

          13:55:52,973 INFO  [stdout] (http--0.0.0.0-8080-4)         parentId=?,

          13:55:52,974 INFO  [stdout] (http--0.0.0.0-8080-4)         previousStatus=?,

          13:55:52,975 INFO  [stdout] (http--0.0.0.0-8080-4)         processId=?,

          13:55:52,975 INFO  [stdout] (http--0.0.0.0-8080-4)         processInstanceId=?,

          13:55:52,976 INFO  [stdout] (http--0.0.0.0-8080-4)         processSessionId=?,

          13:55:52,977 INFO  [stdout] (http--0.0.0.0-8080-4)         skipable=?,

          13:55:52,978 INFO  [stdout] (http--0.0.0.0-8080-4)         status=?,

          13:55:52,979 INFO  [stdout] (http--0.0.0.0-8080-4)         workItemId=?,

          13:55:52,980 INFO  [stdout] (http--0.0.0.0-8080-4)         OPTLOCK=?

          13:55:52,980 INFO  [stdout] (http--0.0.0.0-8080-4)     where

          13:55:52,981 INFO  [stdout] (http--0.0.0.0-8080-4)         id=?

          13:55:52,982 INFO  [stdout] (http--0.0.0.0-8080-4)         and OPTLOCK=?

           

          It's a little bit scary because if this bug occurs in production....

          • 2. Re: New process instance created but no task insert in db
            Demian Calcaprina Master

            Hi Sandra. Could you please share some of the code you are using to start process, register the work items handlers and so on? This may help to be able to help. Which task service are you using? Local task service?

             

            Thanks

             

            Demian

            • 3. Re: New process instance created but no task insert in db
              joploya Newbie

              Hello Demian,

               

              Thank you for your answer. Sur I will give my code. I use the localTaskService.

               

              This is the producer for knowledgeSession :

               

               

              @Stateless
              @LocalBean
              public class KnowledgeSessionProducer implements Serializable{
              
              
                        private static final long serialVersionUID = -4494168896880405667L;
                        private Logger log = LoggerFactory.getLogger(KnowledgeSessionProducer.class);
                        private KnowledgeRuntimeLogger logger;
                        private StatefulKnowledgeSession ksession;
                
                  @PersistenceUnit(unitName = "org.jbpm.task")
                  private EntityManagerFactory emf;
                  private @Inject RecoveryDao recoveryDao;
                
                  public @PostConstruct void init(){
                            log.debug("init of KnowledgeSessionProducer ...");
                  
                            // By Setting the jbpm.usergroup.callback property with the call
                      // back class full name, task service will use this to validate the
                      // user/group exists and its permissions are ok.
                            InputStream usergroupsin = KnowledgeSessionProducer.class.getResourceAsStream(  "/jbpm.usergroup.callback.properties" );
                            if(usergroupsin != null) {
                                      Properties callbackproperties = new Properties();
                                      try {
                                                callbackproperties.load(usergroupsin);
                                                UserGroupCallbackManager.getInstance().setCallbackFromProperties(callbackproperties);
                                                log.debug("Task service registered usergroup callback ...");
                                      } catch (Exception e) {
                                                log.debug("Task service unable to register usergroup callback ...");
                                      }
                            }
                  
                            if(UserGroupCallbackManager.getInstance().existsCallback()){
                                      System.out.println("userGroupCallBack exists ! :)");
                            }else{
                                      System.out.println("userGroupCallBack don't exist ! :(");
                            }
                  
                            TaskService taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
                  
                            taskService.setUserinfo(new AMSUserInfoImpl());
                  
                      TaskServiceSession taskSession = taskService.createSession();
                      // Add users
                      @SuppressWarnings("rawtypes")
                                  Map vars = new HashMap();
                      InputStream usersin = KnowledgeSessionProducer.class.getResourceAsStream( "/LoadUsers.mvel" );
                      if(usersin != null) {
                                Reader reader = new InputStreamReader( usersin );   
                                @SuppressWarnings("unchecked")
                                Map<String, User> users = ( Map<String, User> ) TaskService.eval( reader, vars );   
                                log.debug("Users to load in db : ...");
                                for ( User user : users.values() ) {
                                          taskSession.addUser( user );
                                          log.debug(" - "+user);
                                }           
                      }
                      InputStream groupsin = KnowledgeSessionProducer.class.getResourceAsStream( "/LoadGroups.mvel" );
                      if(groupsin != null) {
                                Reader reader = new InputStreamReader( groupsin );   
                                @SuppressWarnings("unchecked")
                                Map<String, Group> groups = ( Map<String, Group> ) TaskService.eval( reader, vars );     
                                log.debug("Groups to load in db : ...");
                                for ( Group group : groups.values() ) {
                                          taskSession.addGroup( group );
                                          log.debug(" - "+group);
                                }
                      }
                      
                      taskSession.dispose();
                      log.debug("Task service started correctly!");
                      log.debug("Task service running ...");
                  }
                  
                        @Produces
                        @ApplicationScoped
                        public StatefulKnowledgeSession produceKnowledgeSession(){
                                  log.debug("produce the KnowledgeSession ...");
                                  //Create the knowledgeBase
                                  /*This factory is used to build the knowledge base resources that are held collectively in KnowledgePackages.*/
                                  KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
                
                                  //Add all processes to the knowledgeBuilder
                                  List<Resource> resources = getProcessDefinitionList();
                                  for (Resource resource : resources) {
                                            kbuilder.add(resource, ResourceType.BPMN2);
                                  }
                
                                  /*Create a new KnowledgeBase from the knowledge packages that have been added to this builder. 
                                   * An exception is thrown if there are any errors.*/
              //                    assertFalse( kbuilder.hasErrors() );
                                  if ( kbuilder.hasErrors() ) {
                                       log.error( kbuilder.getErrors().toString() );
                                   }
                                  KnowledgeBase kbase = kbuilder.newKnowledgeBase();
                
                                  Environment env = KnowledgeBaseFactory.newEnvironment();
                                  env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
                
                                  if(kbase != null){
                                            System.out.println("knowledge base NOT null");
                                            for(org.drools.definition.process.Process p :kbase.getProcesses()){
                                                      System.out.println(" - process "+p.getName()+" ["+p.getId()+"]");
                                            }
                
                
                                  }
                
                                  //TODO
                                  /*
                                   * recover a persistent knowledge session or instanciate a new one
                                   */
                                  int sessionId = recoveryDao.getPersistentKnowledgeSession();
                
                
                                  if(sessionId < 0){
                                            ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
                                            KnowledgeSessionRecovery kSessionRecovery = new KnowledgeSessionRecovery(ksession.getId());
                                            recoveryDao.savePersistentKnowledgeSession(kSessionRecovery);
                                  }else{
                                            ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null, env);
                                  }
                
                
                
                                  /*Create a new StatefulKnowledgeSession using the default session configuration. 
                                   * Don't forget to dispose() session when you are done.
                                   * Long term out of the box persistence of runtime state with JPA is possible with Drools & jBPM.
                                   * 
                                   * StatefulKnowledgeSession is the most common way to interact with the engine. 
                                   * A StatefulKnowledgeSession allows the application to establish an iterative conversation with the engine, 
                                   * where the state of the session is kept across invocations.*/
              //                    StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
                                  System.out.println(" !!!! DEBUG SESSION PERSISTENCE : new session with id : "+ksession.getId()+" !!!!");
                
                      logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "loggerFile", 1000);
                      KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
                      
                      
                      
                      /*A work item manager is responsible for finding the right work item handler when a work item should be executed 
                       * and should be notified when this work item has been completed (or aborted).
                       * 
                       * Register the given handler for all work items of the given type of work 
                       * This part is done in the LocalHumanTaskService*/
                      WorkItemHandler wihHT = new HumanTaskHandler();
                      ksession.getWorkItemManager().registerWorkItemHandler("Human Task", wihHT );
                      
              //        ksession.getEnvironment().set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
                      
                      /*
                       * Register WorkItem Handler for Email
                       */
              //        EmailWorkItemHandler emailHandler =  new EmailWorkItemHandler();
              //        ksession.getWorkItemManager().registerWorkItemHandler("Email", emailHandler);
                      
                      return ksession;
                        }
                
                        public KnowledgeRuntimeLogger getLogger(){
                                  return this.logger;
                        }
                
                        @PreDestroy
                        public void end(){
                                  ksession.dispose();
                                  log.debug("ksession disposed");
                        }
                
                
                        private List<Resource> getProcessDefinitionList(){
                                  List<Resource> resourceList = new ArrayList<>();
                                  resourceList.add(ResourceFactory.newClassPathResource("workflows/com.st.ams.flows.datacorrections.bpmn2"));
                                  resourceList.add(ResourceFactory.newClassPathResource("workflows/com.st.ams.flows.newfinishedgood.bpmn2"));
                                  resourceList.add(ResourceFactory.newClassPathResource("workflows/com.st.ams.flows.newproductline.bpmn2"));
                                  resourceList.add(ResourceFactory.newClassPathResource("workflows/com.st.ams.flows.nfep.bpmn2"));
                                  resourceList.add(ResourceFactory.newClassPathResource("workflows/com.st.ams.flows.newcpbeforem29commontrunk.bpmn2"));
                                  resourceList.add(ResourceFactory.newClassPathResource("workflows/com.st.ams.flows.newcpbeforem29.bpmn2"));
                
                                  /**
                                   * TODO 
                                   * add all other process here
                                   */
                                  return resourceList;
                        }
              }
              
              

               

              and here the method in a class where I put all functions to interact with the engine :

               

              /**
                         * Start a new processInstance of an existing Process
                         * and set the variables of this instance
                         * @param processId, map of variables
                         * @return ProcessInstance created
                         */
                        public ProcessInstance startProcess(String processId, Map<String, Object> parameters){
                                  ProcessInstance p = kSession.startProcess(processId,parameters);
                                  return p;
                        }
                
                        /**
                         * Return the WorkflowProcessInstance associated to a Task
                         * This instance allow to access the map of variables
                         * @return WorkflowProcessInstance managed
                         */
                        public WorkflowProcessInstance getWorkflowProcessInstance(long processInstanceId){
                                  return (WorkflowProcessInstance)kSession.getProcessInstance(processInstanceId);
                        }
                
                        /**
                         * This method allow to access object store in
                         * process instance variables
                         * @return an object link to the processInstance
                         */
                        public Object getProcessVariable(final Long processInstanceId, Long taskId, String key){
                                  Object retObj = null;
                
                                  WorkflowProcessInstance wpi = (WorkflowProcessInstance)kSession.getProcessInstance(processInstanceId);
                                  if((wpi == null) || (wpi.getVariable(key) == null)){
                                            System.out.println("workflow process instance is null :-(");
                                            Map<String, Object> variables = kSession.execute(new GenericCommand<Map<String, Object>>() {
              
              
                                                public Map<String, Object> execute(Context context) {
                                                    StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();
                                                    org.jbpm.process.instance.ProcessInstance processInstance = (org.jbpm.process.instance.ProcessInstance) ksession.getProcessInstance(processInstanceId);
                                                    VariableScopeInstance variableScope = (VariableScopeInstance) processInstance.getContextInstance(VariableScope.VARIABLE_SCOPE);
                                                    Map<String, Object> variables = variableScope.getVariables();
                                                    return variables;
                                                }
              
              
                                            });
                                            System.out.println("variables size : "+variables.size());
                                            for(String str : variables.keySet()){
                                                      System.out.println(" - "+str);
                                            }
                                            retObj = variables.get(key);
                                  }else{
                                            System.out.println("workflow process instance is NOT null :-)");
                                            retObj = wpi.getVariable(key);
                                  }
                                  if(retObj == null){
                                            System.out.println(" get variable return null ::-(");
                                  }else{
                                            System.out.println(" get variable return "+retObj.toString()+"  |-)");
                                  }
                                  return retObj;
                        }
              
              

               

              Thanks again.

              • 4. Re: New process instance created but no task insert in db
                joploya Newbie

                I make a lot of try starting several processes and it's seems to be totally randomly. Sometimes the process is created and then the task is also created and persist, and most of the time the process is created but not the task.

                 

                It's very hard to debug because there is no error anywhere. The problem seems to appeared where I start using

                ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null, env);

                and I also add the method for dispose the ksession in the same time.

                 

                EDIT :

                It is not totally randomly in fact.

                The knoledgeSession is in Application Scope, the first time I deploy the application and access to jbpm, if the instanciation of a new process instance is directly after the session recovery no task is created.

                If the session already loaded, most of the time all works fine.

                The out of the console logger of jbpm is the same in both cases, only the hibernate request to persist task info disapear. So, perhaps it is due to a concurrent access problem?

                 

                Do I need an Asynchronous workitemhandler in the case of local task?

                • 5. Re: New process instance created but no task insert in db
                  Maulee Parikh Newbie

                  Hi Sandra,

                   

                  Have you found any fix for this ? I am facing same issue.

                   

                  Thanks.