[jboss-user] [jBPM] - Re: ProcessContext Throwing NPE

Shobhit Tyagi do-not-reply at jboss.com
Thu Mar 14 12:49:48 EDT 2013


Shobhit Tyagi [https://community.jboss.org/people/roxy1987] created the discussion

"Re: ProcessContext Throwing NPE"

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

--------------------------------------------------------------
Thomas,

I tried the code. but it didnt work. Its the same thing. Following is my process def : 


  <?xml version="1.0" encoding="UTF-8"?> 
<definitions id="Definition"
targetNamespace="http://www.jboss.org/drools"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
xmlns:g="http://www.jboss.org/drools/flow/gpd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">

<itemDefinition id="_taskUserItem" structureRef="String" />

<itemDefinition id="_2-taskUserItem" structureRef="String" />

<itemDefinition id="_3-taskUserItem" structureRef="String" />

<process processType="Private" isExecutable="true" id="com.sample.dynamicTaskVariable" name="Dynamic Task Variable Process" tns:packageName="defaultPackage" >

<!-- process variables -->
<property id="taskUser" itemSubjectRef="_taskUserItem"/>

<!-- nodes -->
<startEvent id="_1" name="StartProcess" />
<userTask id="_2" name="Create Variable" >
<ioSpecification>
<dataInput id="_2_TaskNameInput" name="TaskName" />
<dataInput id="_2_CommentInput" name="Comment" />
<dataOutput id="_2_taskVariableOutput" name="taskVariable" />
<inputSet>
<dataInputRefs>_2_TaskNameInput</dataInputRefs>
<dataInputRefs>_2_CommentInput</dataInputRefs>
</inputSet>
<outputSet>
<dataOutputRefs>_2_taskVariableOutput</dataOutputRefs>
</outputSet>
</ioSpecification>
<dataInputAssociation>
<targetRef>_2_TaskNameInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression">Create Variable</from>
<to xsi:type="tFormalExpression">_2_TaskNameInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>_2_CommentInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression">createVariable.xhtml</from>
<to xsi:type="tFormalExpression">_2_CommentInput</to>
</assignment>
</dataInputAssociation>
<dataOutputAssociation>
<sourceRef>_2_taskVariableOutput</sourceRef>
<targetRef>taskUser</targetRef>
</dataOutputAssociation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>krisv</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<userTask id="_3" name="Verify Variable" >
<ioSpecification>
<dataInput id="_3_TaskNameInput" name="TaskName" />
<dataInput id="_3_CommentInput" name="Comment" />
<inputSet>
<dataInputRefs>_3_TaskNameInput</dataInputRefs>
<dataInputRefs>_3_CommentInput</dataInputRefs>
</inputSet>
<outputSet>
</outputSet>
</ioSpecification>
<dataInputAssociation>
<targetRef>_3_TaskNameInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression">Verify Variable</from>
<to xsi:type="tFormalExpression">_3_TaskNameInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>_3_CommentInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression">verifyVariable.xhtml</from>
<to xsi:type="tFormalExpression">_3_CommentInput</to>
</assignment>
</dataInputAssociation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>#{taskUser}</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<endEvent id="_4" name="End" >
<terminateEventDefinition />
</endEvent>

<!-- connections -->
<sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
<sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
<sequenceFlow id="_3-_4" sourceRef="_3" targetRef="_4" />

</process>

<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="com.sample.dynamicTaskVariable" >
<bpmndi:BPMNShape bpmnElement="_1" >
<dc:Bounds x="132" y="216" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_2" >
<dc:Bounds x="228" y="204" width="169" height="73" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" >
<dc:Bounds x="444" y="204" width="169" height="73" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_4" >
<dc:Bounds x="672" y="216" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_1-_2" >
<di:waypoint x="156" y="240" />
<di:waypoint x="312" y="240" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_2-_3" >
<di:waypoint x="312" y="240" />
<di:waypoint x="528" y="240" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_3-_4" >
<di:waypoint x="528" y="240" />
<di:waypoint x="696" y="240" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>

</definitions>



Then I complete the task as following : 


public static void completeTask(long taskId, String userId, Map<String, Object> map) throws Exception
 {
  String name = "client 1"+UUID.randomUUID();
  TaskClient client = new TaskClient(new HornetQTaskClientConnector(name, new HornetQTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
  BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
  ContentData contentData = null;
  client.connect(ipAddress, port);
  try
  {
   contentData = ContentMarshallerHelper.marshal(map, null);
   client.complete(taskId, userId, contentData, responseHandler);
   responseHandler.waitTillDone(5000);
   BpmAPI.completeWorkItem(taskId);
  }
  catch(Exception e)
  {
   BpmExceptionHandler.handleException(e);
  }
  finally
  {
   if(client != null)
   {
    client.disconnect();
   } 
  }
 }
 


In the map above I put a variable for next task. 
Only difference in the code is that I complete the task and then I complete the work item.

Regards.
--------------------------------------------------------------

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

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/20130314/08f7fc89/attachment.html 


More information about the jboss-user mailing list