Re: [jboss-user] [jBPM] - NPE while serviceTask call
by Claus Straube
Claus Straube [http://community.jboss.org/people/clauss] replied to the discussion
"NPE while serviceTask call"
To view the discussion, visit: http://community.jboss.org/message/534980#534980
--------------------------------------------------------------
arrrrg - found the mistake (of course one minute after my post). Here is the correct code:
<?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>im</bpmn:inMessageRef>
<bpmn:outMessageRef>om</bpmn:outMessageRef>
</bpmn:operation>
</bpmn:interface>
<!-- process definition -->
<bpmn:process id="foobar" name="async_process">
<bpmn:startEvent id="s" />
<bpmn:sequenceFlow id="f1" name="s_2_r1" sourceRef="s" targetRef="r1" />
<bpmn:receiveTask id="r1" name="r1" />
<!-- -->
<bpmn:sequenceFlow id="f2" name="r1_2_t1" sourceRef="r1" targetRef="st1" />
<bpmn:serviceTask id="st1" name="st1" implementation="Other" operationRef="o1"/>
<bpmn:sequenceFlow id="f3" name="st1_2_r2" sourceRef="st1" targetRef="r2" />
<!-- -->
<!--
<bpmn:sequenceFlow id="fx" name="r1_2_r2" sourceRef="r1" targetRef="r2" />
-->
<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>
The problem was the in and out message ref.
Best regards - claus
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/534980#534980]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 9 months
[jBPM] - NPE while serviceTask call
by Claus Straube
Claus Straube [http://community.jboss.org/people/clauss] created the discussion
"NPE while serviceTask call"
To view the discussion, visit: http://community.jboss.org/message/534977#534977
--------------------------------------------------------------
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>
<!-- process definition -->
<bpmn:process id="foobar" name="async_process">
<bpmn:startEvent id="s" />
<bpmn:sequenceFlow id="f1" name="s_2_r1" sourceRef="s" targetRef="r1" />
<bpmn:receiveTask id="r1" name="r1" />
<!-- start -->
<bpmn:sequenceFlow id="f2" name="r1_2_t1" sourceRef="r1" targetRef="t1" />
<bpmn:serviceTask id="st1" name="st1" implementation="Other" operationRef="o1"/>
<bpmn:sequenceFlow id="f3" name="st1_2_r2" sourceRef="st1" targetRef="r2" />
<!-- end -->
<!--
<bpmn:sequenceFlow id="fx" name="r1_2_r2" sourceRef="r1" targetRef="r2" />
-->
<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
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/534977#534977]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 9 months
Re: [jboss-user] [jBPM] - jBPM 4.3 starting a sub-process after a state node will fail
by Tun Mang
Tun Mang [http://community.jboss.org/people/tunmang] replied to the discussion
"jBPM 4.3 starting a sub-process after a state node will fail"
To view the discussion, visit: http://community.jboss.org/message/534973#534973
--------------------------------------------------------------
Hi Maciej :
Thanks for your help. The event listener is just for my own transition visibility. After I removed all the event listeners in the process definition (as shown below), re-deploy, re-start the process instance. When the "token" reached the state node, I call executionService.signalExecutionById("SimSubProc.290001"), and it throws the same exceptions.
I get the executionService by calling processEngine.getExecutionService(). Is there something I missed ?
The puzzle I cannot figure out is why if I remove the "check_id" state node and make the start node's transition directly go to the sub-process, everything goes fine.
Thanks a lot for your help again.
Tun Mang
=================================
<?xml version="1.0" encoding="UTF-8"?>
<process name="SimSubProc" xmlns=" http://jbpm.org/4.3/jpdl http://jbpm.org/4.3/jpdl">
<start >
<transition to="check_id" ></transition>
</start>
<state name="check_id" >
<transition to="review" ></transition>
</state>
<sub-process name="review" sub-process-key="SubProcTasks" >
<transition to="ok" ></transition>
</sub-process>
<state name="ok" >
<transition to="end" ></transition>
</state>
<end name="end" ></end>
</process>
===================================
09:03:17,937 INF | [CheckDbCmd] jBPM version info: library[4.3], schema[4.3]
Process Engine Identity Hash Code: 4781685
09:03:18,765 WRN | [JDBCExceptionReporter] SQL Error: 1452, SQLState: 23000
09:03:18,765 SEV | [JDBCExceptionReporter] Cannot add or update a child row: a foreign key constraint fails (`jbpm_4_3/jbpm4_execution`, CONSTRAINT `FK_EXEC_SUBPI` FOREIGN KEY (`SUBPROCINST_`) REFERENCES `jbpm4_execution` (`DBID_`))
### EXCEPTION ###########################################
09:03:18,765 SEV | [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could not update: [org.jbpm.pvm.internal.model.ExecutionImpl#290001]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2425)
....
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.jbpm.pvm.internal.id.AcquireDbidBlockCmd.execute(AcquireDbidBlockCmd.java:35)
at org.jbpm.pvm.internal.id.AcquireDbidBlockCmd.execute(AcquireDbidBlockCmd.java:10)
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
....
at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:84)
... 37 more
### EXCEPTION ###########################################
### EXCEPTION ###########################################
09:03:18,781 INF | [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.SignalCmd@c017e9
org.jbpm.api.JbpmException: couldn't acquire block of ids
at org.jbpm.pvm.internal.id.DatabaseDbidGenerator.getNextId(DatabaseDbidGenerator.java:65)
at org.jbpm.pvm.internal.model.ExecutionImpl.save(ExecutionImpl.java:194)
at org.jbpm.pvm.internal.model.ExecutionImpl.initializeProcessInstance(ExecutionImpl.java:187)
at org.jbpm.pvm.internal.model.ProcessDefinitionImpl.createProcessInstance(ProcessDefinitionImpl.java:106)
at org.jbpm.jpdl.internal.activity.SubProcessActivity.execute(SubProcessActivity.java:70)
at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:656)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:616)
at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:417)
at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:61)
at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:35)
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:84)
....
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/534973#534973]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 9 months