<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Persisted timer event couldn't find work item handler after reload
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/tmag">tmag</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/760475#760475">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>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 !!</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Its a simple timer task with 500ms delay &amp; 30 sec period - which sends a reminder email every 30 sec . We need this process to be persistent to be able to restore anytime.</p><p>For testing am using Postgres.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p>2) When I reload the session quickly within the period&#160; (30 sec) - there are no exceptions &amp; able to see timer event kicking off reminders as per schedule. Here is my code :</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160; <strong> setupDataSource();&#160;&#160;&#160; // postgres datasource</strong></p><p><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Environment env = getEnvironment();</strong></p><p><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160; KnowledgeBase kbase = createKnowledgeBase("IncidentProcess.bpmn");</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p><strong>&#160;&#160;&#160;&#160;&#160;&#160; StatefulKnowledgeSession ksession = JPAKnowledgeService.loadStatefulKnowledgeSession( &lt;sessionId&gt;, kbase, null, env );</strong></p><p>&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000;"><strong> ksession.getWorkItemManager().registerWorkItemHandler("Email", new SystemOutWorkItemHandler());</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>3)&#160; <strong>But when I wait more than 30 sec., say upto 5 minutes (in relatime - maintenance may take hours) &amp; 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. </strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Hibernate: select nextval ('WORKITEMINFO_ID_SEQ')</p><p>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=?</p><p>Hibernate: select processins0_.InstanceId as col_0_0_ from ProcessInstanceInfo processins0_ inner join EventTypes eventtypes1_ on processins0_.InstanceId=eventtypes1_.InstanceId where eventtypes1_.element=?</p><p>Unable to execute timer job!</p><p>org.drools.RuntimeDroolsException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction@1516f91</p><p>&#160;&#160;&#160; at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:979)</p><p>&#160;&#160;&#160; at org.drools.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:866)</p><p>&#160;&#160;&#160; at org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:90)</p><p>&#160;&#160;&#160; at org.jbpm.process.instance.timer.TimerManager$ProcessJob.execute(TimerManager.java:278)</p><p>&#160;&#160;&#160; at org.drools.time.SelfRemovalJob.execute(SelfRemovalJob.java:15)</p><p>&#160;&#160;&#160; at org.drools.time.impl.DefaultTimerJobInstance.call(DefaultTimerJobInstance.java:47)</p><p>&#160;&#160;&#160; at org.drools.persistence.jpa.JpaTimerJobInstance.internalCall(JpaTimerJobInstance.java:43)</p><p>&#160;&#160;&#160; at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:20)</p><p>&#160;&#160;&#160; at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:6)</p><p>&#160;&#160;&#160; at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)</p><p>&#160;&#160;&#160; at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:367)</p><p>&#160;&#160;&#160; at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:34)</p><p>&#160;&#160;&#160; at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:14)</p><p>&#160;&#160;&#160; at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)</p><p>&#160;&#160;&#160; at java.util.concurrent.FutureTask.run(Unknown Source)</p><p>&#160;&#160;&#160; at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)</p><p>&#160;&#160;&#160; at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)</p><p>&#160;&#160;&#160; at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)</p><p>&#160;&#160;&#160; at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)</p><p>&#160;&#160;&#160; at java.lang.Thread.run(Unknown Source)</p><p>Caused by: org.jbpm.workflow.instance.WorkflowRuntimeException: [com.ecom.incident.process:8 - Reminder:5] -- Could not find work item handler for Email</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:130)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:205)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:213)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:100)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:124)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:205)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:164)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:162)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.node.TimerNodeInstance.triggerCompleted(TimerNodeInstance.java:135)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.node.TimerNodeInstance.signalEvent(TimerNodeInstance.java:125)</p><p>&#160;&#160;&#160; at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:326)</p><p>&#160;&#160;&#160; at org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction.execute(DefaultSignalManager.java:118)</p><p>&#160;&#160;&#160; at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:977)</p><p>&#160;&#160;&#160; ... 19 more</p><p>Hibernate: insert into WorkItemInfo (creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray, workItemId) values (?, ?, ?, ?, ?, ?, ?)</p><p>Hibernate: update WorkItemInfo set creationDate=?, name=?, processInstanceId=?, state=?, OPTLOCK=?, workItemByteArray=? where workItemId=? and OPTLOCK=?</p><p>Hibernate: delete from EventTypes where InstanceId=?</p><p><span style="color: #ff0000;"><strong>Hibernate: delete from ProcessInstanceInfo where InstanceId=? and OPTLOCK=?</strong></span></p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/2-760475-19528/IncidentProcess2-image.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/2-760475-19528/450-146/IncidentProcess2-image.png </span></a></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/760475#760475">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>