process disconnected exception after accsessing process variable
jayzay212 Aug 20, 2015 3:50 AMHey everyone,
i am running jbpm 6.2 final with persistence in an osgi environment and i want to access a process variable in a running flow. After some search i found this code snippet to change a variables' value:
WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.getProcessInstance(processid);
processInstance.setVariable(variablename, value);
But everytime i try to set a new value i get a runtime exception:
java.lang.RuntimeException: Process instance 1[com.sample.bpmn] is disconnected.
at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:100)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setVariable(WorkflowProcessInstanceImpl.java:284)
at de.cjt.estuss.core.jbpm.impl.ProcessManager.setSpecificProcessVariable(ProcessManager.java:419)
at de.cjt.estuss.vacation.jbpm.uiprovider.VacationObservingTaskDialog.completeTask(VacationObservingTaskDialog.java:217)
at de.cjt.estuss.vacation.jbpm.uiprovider.VacationObservingTaskDialog.accept(VacationObservingTaskDialog.java:171)
at de.cjt.estuss.vacation.jbpm.uiprovider.VacationObservingTaskDialog.acceptPressed(VacationObservingTaskDialog.java:244)
at de.cjt.estuss.vacation.jbpm.uiprovider.VacationObservingTaskDialog.access$2(VacationObservingTaskDialog.java:243)
at de.cjt.estuss.vacation.jbpm.uiprovider.VacationObservingTaskDialog$2.handleEvent(VacationObservingTaskDialog.java:305)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:700)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:602)
at org.eclipse.swt.widgets.Display.executeNextEvent(Display.java:1212)
at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1193)
at org.eclipse.swt.widgets.Display.safeReadAndDispatch(Display.java:1176)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1168)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:857)
at org.eclipse.jface.window.Window.open(Window.java:833)
at de.cjt.estuss.vacation.jbpm.uiprovider.VacationObservingTask.action(VacationObservingTask.java:36)
at de.cjt.estuss.core.ui.home.TaskOverview$ActionSelectionListener.widgetSelected(TaskOverview.java:146)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:262)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:700)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:602)
at org.eclipse.swt.widgets.Display.executeNextEvent(Display.java:1212)
at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1193)
at org.eclipse.swt.widgets.Display.safeReadAndDispatch(Display.java:1176)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1168)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1136)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1017)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.rap.e4.E4EntryPointFactory.createWorkbench(E4EntryPointFactory.java:86)
at org.eclipse.rap.e4.E4EntryPointFactory.access$0(E4EntryPointFactory.java:60)
at org.eclipse.rap.e4.E4EntryPointFactory$1.createUI(E4EntryPointFactory.java:51)
at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:172)
at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:284)
at java.lang.Thread.run(Unknown Source)
at org.eclipse.rap.rwt.internal.lifecycle.UIThread.run(UIThread.java:105)
Is this the right way or is there a better way to change a process variable (without humantask interaction)?
Regards,
Sebastian