[jboss-user] [jBPM] - Re: Restart JBPM5 Process after system crash

Swaminathan Bhaskar do-not-reply at jboss.com
Mon Jun 11 21:26:14 EDT 2012


Swaminathan Bhaskar [https://community.jboss.org/people/swaminathan.bhaskar] created the discussion

"Re: Restart JBPM5 Process after system crash"

To view the discussion, visit: https://community.jboss.org/message/741104#741104

--------------------------------------------------------------
Is this the correct way to identify and restart a crashed process instance ?

                    ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null, env);
                    if (ksession != null) {
                         Collection instances = ksession.getProcessInstances();
                         if (instances != null && instances.size() > 0) {
                              for (ProcessInstance processInstance : instances) {
                                   System.out.printf("\n*** Restarting old Business process [%s]\n", processInstance.getProcessId());
                                   
                                   // Start the BPM process
                                   ksession.startProcessInstance(processInstance.getId());
                                   
                                   // Trigger the signal
                                   ksession.signalEvent("Trigger", null);
                                   
                                   // Did the process instance complete successfully ?
                                   if (processInstance.getState() == ProcessInstance.STATE_COMPLETED) {
                                        System.out.printf("\nBusiness process [%s] successfully completed after restart\n", processInstance.getProcessId());
                                   }
                              }
                         }
                    }
                    else {
                         System.out.println("***** WARNING: No session found for session-id " + sessionId);
                    }


This is not working and I get the following exception:

Hibernate: select sessioninf0_.id as id1_0_, sessioninf0_.lastModificationDate as lastModi2_1_0_, sessioninf0_.rulesByteArray as rulesByt3_1_0_, sessioninf0_.startDate as startDate1_0_, sessioninf0_.OPTLOCK as OPTLOCK1_0_ from SessionInfo s
essioninf0_ where sessioninf0_.id=?
0    11/06 20:43:55,210[main] ERROR drools.persistence.SingleSessionCommandService.rollbackTransaction  - Could not commit session
java.lang.NullPointerException
        at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.getProcessInstances(JPAProcessInstanceManager.java:97)
        at org.jbpm.process.instance.ProcessRuntimeImpl.getProcessInstances(ProcessRuntimeImpl.java:200)
        at org.drools.common.AbstractWorkingMemory.getProcessInstances(AbstractWorkingMemory.java:1093)
        at org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstances(StatefulKnowledgeSessionImpl.java:292)
        at org.drools.command.runtime.process.GetProcessInstancesCommand.execute(GetProcessInstancesCommand.java:35)
        at org.drools.command.runtime.process.GetProcessInstancesCommand.execute(GetProcessInstancesCommand.java:28)
        at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
        at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:345)
        at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getProcessInstances(CommandBasedStatefulKnowledgeSession.java:139)

Any ideas ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/741104#741104]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120611/90818b03/attachment-0001.html 


More information about the jboss-user mailing list