-
1. Re: Restart JBPM5 Process after system crash
jimmy.dongjia Jun 5, 2012 10:47 PM (in response to swaminathan.bhaskar)Do you use yourself app? not use console? if so, I hava the same problem with you.
And do you mind share your bpmn file and code? I want to study how to use
signal task ,thanks!!
-
2. Re: Restart JBPM5 Process after system crash
swaminathan.bhaskar Jun 7, 2012 11:28 AM (in response to swaminathan.bhaskar)After some searching looks like we will have to get the sessionId and save it aside and use it later to restart the process. Is this correct ? Is there a know pattern for managing the sessionId ? Anyone solved this ? Can anyone help ?. Thanks
-
3. Re: Restart JBPM5 Process after system crash
swaminathan.bhaskar Jun 11, 2012 9:26 PM (in response to swaminathan.bhaskar)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 ?
-
4. Re: Restart JBPM5 Process after system crash
calca Jun 11, 2012 9:58 PM (in response to swaminathan.bhaskar)1 of 1 people found this helpfulHey,
at the moment of the "crash", the processes has been persisted? A process is persisted when it reaches a "wait state". I catching signal event is a wait state.
If so, you can simply do,
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null, env);
ksession.signalEvent("Trigger", null);
as the processes are already persisted in db.
Demian
-
5. Re: Restart JBPM5 Process after system crash
swaminathan.bhaskar Jun 12, 2012 9:20 AM (in response to calca)Thank for the useful tip Demian. This means I need to keep track of the sessiin ID as well as the process ID so that I can recreate the session and check the process status.
-
6. Re: Restart JBPM5 Process after system crash
nbd Sep 17, 2012 8:27 AM (in response to swaminathan.bhaskar)Hi,
Did you solve it? I'm having the same problem. My process instances are persisted - I can look them up in the database. After server restart I reload the previous session,
but the process instances don't continue. What ksession.signalEvent("Trigger", null); is supposed to do here? My process instances are not waiting for any event and even
if they were, they wouldn't react as the instances are not being executed.
-
7. Re: Restart JBPM5 Process after system crash
hansi007 Sep 17, 2012 11:04 AM (in response to nbd)Another option could be to remember the work_item / work_item_id that you stopped at without completing it. Than you can continue that process by completing that workitem:
int workitemId = ... //From the work item that you remembered. StatefulKnowledgeSession ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, config, env ); WorkItemManager wManager = ksession.getWorkItemManager(); wManager.completeWorkItem(workitemId,null);
-
8. Re: Restart JBPM5 Process after system crash
nbd Sep 19, 2012 4:14 AM (in response to hansi007)Yes, but I would like to execute the unfinished workitem, and calling
wManager.completeWorkItem(workitemId,null);
will just complete it without executing workitemhandlercode