JBoss Community

Persisted timer event couldn't find work item handler after reload

created by tmag in jBPM - View the full discussion

We are planning to start using JBPM 5.3 in our organization, and started with the following simple process which has the deadline for this month end. Please help !!

 

Its a simple timer task with 500ms delay & 30 sec period - which sends a reminder email every 30 sec . We need this process to be persistent to be able to restore anytime.

For testing am using Postgres.

 

1) First am starting a process and after a couple of reminder emails sent out (say after 1 minute) stopping that process to simulate a failure scenerio. Then am reloading the session.

2) When I reload the session quickly within the period  (30 sec) - there are no exceptions & able to see timer event kicking off reminders as per schedule. Here is my code :

 

       setupDataSource();    // postgres datasource

        Environment env = getEnvironment();

        KnowledgeBase kbase = createKnowledgeBase("IncidentProcess.bpmn");

       

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

      ksession.getWorkItemManager().registerWorkItemHandler("Email", new SystemOutWorkItemHandler());

 

3)  But when I wait more than 30 sec., say upto 5 minutes (in relatime - maintenance may take hours) & reload the session - getting the following exception about WorkItemHanlder which am registering as above. But seems its failing while loading session itself. Also its deleting entry from 'ProcessInstanceInfo' table.

 

 

Hibernate: select nextval ('WORKITEMINFO_ID_SEQ')

Hibernate: select workitemin0_.workItemId as workItemId4_0_, workitemin0_.creationDate as creation2_4_0_, workitemin0_.name as name4_0_, workitemin0_.processInstanceId as processI4_4_0_, workitemin0_.state as state4_0_, workitemin0_.OPTLOCK as OPTLOCK4_0_, workitemin0_.workItemByteArray as workItem7_4_0_ from WorkItemInfo workitemin0_ where workitemin0_.workItemId=?

Hibernate: select processins0_.InstanceId as col_0_0_ from ProcessInstanceInfo processins0_ inner join EventTypes eventtypes1_ on processins0_.InstanceId=eventtypes1_.InstanceId where eventtypes1_.element=?

Unable to execute timer job!

org.drools.RuntimeDroolsException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction@1516f91

    at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:979)

    at org.drools.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:866)

    at org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:90)

    at org.jbpm.process.instance.timer.TimerManager$ProcessJob.execute(TimerManager.java:278)

    at org.drools.time.SelfRemovalJob.execute(SelfRemovalJob.java:15)

    at org.drools.time.impl.DefaultTimerJobInstance.call(DefaultTimerJobInstance.java:47)

    at org.drools.persistence.jpa.JpaTimerJobInstance.internalCall(JpaTimerJobInstance.java:43)

    at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:20)

    at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:6)

    at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)

    at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:367)

    at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:34)

    at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:14)

    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)

    at java.util.concurrent.FutureTask.run(Unknown Source)

    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)

    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

    at java.lang.Thread.run(Unknown Source)

Caused by: org.jbpm.workflow.instance.WorkflowRuntimeException: [com.ecom.incident.process:8 - Reminder:5] -- Could not find work item handler for Email

    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:130)

    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:205)

    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:213)

    at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:100)

    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:124)

    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:205)

    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:164)

    at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)

    at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:162)

    at org.jbpm.workflow.instance.node.TimerNodeInstance.triggerCompleted(TimerNodeInstance.java:135)

    at org.jbpm.workflow.instance.node.TimerNodeInstance.signalEvent(TimerNodeInstance.java:125)

    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:326)

    at org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction.execute(DefaultSignalManager.java:118)

    at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:977)

    ... 19 more

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

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

Hibernate: delete from EventTypes where InstanceId=?

Hibernate: delete from ProcessInstanceInfo where InstanceId=? and OPTLOCK=?

https://community.jboss.org/servlet/JiveServlet/downloadImage/2-760475-19528/450-146/IncidentProcess2-image.png

Reply to this message by going to Community

Start a new discussion in jBPM at Community