获取不到processDefinition对象
来源:3-11 Activiti6.0源码初探-helloword_idea-3
慕圣1598625
2019-11-16
deploymentBuilder.addClasspathResource(“test.xml”);
Deployment deployment = deploymentBuilder.deploy();
String deploymentId = deployment.getId();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.deploymentId(deploymentId)
.singleResult();
根据自己的xml流程配置文件获取processDefinition 始终为null ,这是啥原因啊,老师`
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="testApprove" name="测试审批流程" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<userTask id="user_info" name="提交申请">
<extensionElements>
<activiti:formProperty id="context" name="申请类容" type="string" required="true"></activiti:formProperty>
<activiti:formProperty id="isok" name="是否提交" type="string" required="true"></activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="user_info"></sequenceFlow>
<exclusiveGateway id="is_submit" name="确定提交"></exclusiveGateway>
<sequenceFlow id="flow2" sourceRef="user_info" targetRef="is_submit"></sequenceFlow>
<userTask id="lb_approve" name="老板审批">
<extensionElements>
<activiti:formProperty id="lb_context" name="审批建议" type="string" required="true"></activiti:formProperty>
<activiti:formProperty id="is_sure" name="确定审批" type="string" required="true"></activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="flow3" name="确定" sourceRef="is_submit" targetRef="lb_approve">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${ isok == "yes" }]]></conditionExpression>
</sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow4" name="取消" sourceRef="is_submit" targetRef="endevent1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${ isok == "no" }]]></conditionExpression>
</sequenceFlow>
<exclusiveGateway id="is_approve" name="确定审批"></exclusiveGateway>
<sequenceFlow id="flow5" sourceRef="lb_approve" targetRef="is_approve"></sequenceFlow>
<sequenceFlow id="flow6" name="拒绝" sourceRef="is_approve" targetRef="user_info">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${ is_sure=="yes" }]]></conditionExpression>
</sequenceFlow>
<endEvent id="endevent2" name="End"></endEvent>
<sequenceFlow id="flow7" name="同意" sourceRef="is_approve" targetRef="endevent2">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${ is_sure == "no" }]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_testApprove">
<bpmndi:BPMNPlane bpmnElement="testApprove" id="BPMNPlane_testApprove">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="233.0" y="20.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="user_info" id="BPMNShape_user_info">
<omgdc:Bounds height="55.0" width="105.0" x="198.0" y="91.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="is_submit" id="BPMNShape_is_submit">
<omgdc:Bounds height="40.0" width="40.0" x="230.0" y="170.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="lb_approve" id="BPMNShape_lb_approve">
<omgdc:Bounds height="55.0" width="105.0" x="198.0" y="230.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="430.0" y="173.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="is_approve" id="BPMNShape_is_approve">
<omgdc:Bounds height="40.0" width="40.0" x="230.0" y="320.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
<omgdc:Bounds height="35.0" width="35.0" x="233.0" y="400.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="250.0" y="55.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="91.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="250.0" y="146.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="170.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="250.0" y="210.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="230.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="100.0" x="250.0" y="210.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="270.0" y="190.0"></omgdi:waypoint>
<omgdi:waypoint x="430.0" y="190.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="100.0" x="270.0" y="190.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="250.0" y="285.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="320.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="230.0" y="340.0"></omgdi:waypoint>
<omgdi:waypoint x="128.0" y="340.0"></omgdi:waypoint>
<omgdi:waypoint x="128.0" y="118.0"></omgdi:waypoint>
<omgdi:waypoint x="198.0" y="118.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="100.0" x="230.0" y="340.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
<omgdi:waypoint x="250.0" y="360.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="400.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="100.0" x="250.0" y="360.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
写回答
1回答
-
Jimmy
2019-11-18
可以通过debug或者增加日志打印逐步一下排查问题,确认一下deploymentId是否正确,校验一下repositoryService.createProcessDefinitionQuery()不使用其它条件能否查询到lis数据
00
相似问题