Hi all,
I'm always running in a NPE with BPMN 2.0 (jBPM 4.3) and Spring 2.5.3.
This is my testcase:
@Test
public void testAsyncCalls(){
//deploy process
repositoryService.createDeployment().addResourceFromClasspath("async_service_call.bpmn.xml").deploy();
//start instance
ProcessInstance instance = executionService.startProcessInstanceByKey("foobar");
Assert.assertNotNull(instance);
//get instance id
String iid = instance.getId();
//set instance id as variable
executionService.setVariable(iid, "instanceId", iid);
//signal first execution
Execution e1 = instance.findActiveExecutionIn("r1");
Assert.assertNotNull(e1);
executionService.signalExecutionById(e1.getId());
//get instance back
ProcessInstance instance2 = executionService.findProcessInstanceById(iid);
Assert.assertNotNull(instance2);
//check if the var has been set
Assert.assertEquals("foo", executionService.getVariable(iid, "v1"));
//signal second execution
Execution e2 = instance2.findActiveExecutionIn("r2");
Assert.assertNotNull(e2);
ProcessInstance instance3 = executionService.signalExecutionById(e2.getId());
//check if the instance has been ended
Assert.assertTrue(instance3.isEnded());
}
This is the process:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions id="ServiceTaskJava"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 BPMN20.xsd"
xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/"
xmlns:jbpm="http://jbpm.org/4.0/bpmn2">
<bpmn:itemDefinition id="i1">
<jbpm:arg>
<jbpm:object expr="#{instanceId}" />
</jbpm:arg>
</bpmn:itemDefinition>
<bpmn:itemDefinition id="i2">
<jbpm:var name="v1" />
</bpmn:itemDefinition>
<bpmn:message id="im" name="input message"
structureRef="i1"></bpmn:message>
<bpmn:message id="om" name="output message"
structureRef="i2">
</bpmn:message>
<bpmn:interface id="if1" name="mocks.Mock01">
<bpmn:operation id="o1" name="call">
<bpmn:inMessageRef>inputMessage</bpmn:inMessageRef>
<bpmn:outMessageRef>outputMessage</bpmn:outMessageRef>
</bpmn:operation>
</bpmn:interface>
<bpmn:receiveTask id="r2" name="r2" />
<bpmn:sequenceFlow id="f4" name="r2_2_e1" sourceRef="r2" targetRef="e1" />
<bpmn:endEvent id="e1" name="e1" />
</bpmn:process>
</bpmn:definitions>
and this is the service I want to call:
package mocks;
public class Mock01 {
public String call(String var){
System.out.println(var);
return "foo";
}
}
If I comment out the lines between 'start' and 'end' in my process (and comment in the flow between r1 and r2) no NPE happens (of cource the test fails). But if I run the process as it is, I will get a npe. Can onyone give me a hint where the problem is?
Thanks in advance - Claus