Java camunda异常找不到id为空的任务任务任务
首先我想说,我已经看到了这个问题:这个问题不是我的问题 我使用jersey构建了一个RESTAPI,并且使用了camunda工作流引擎 我使用了jersey quickstart grizzly maven archtype,然后定义了如下流程资源:Java camunda异常找不到id为空的任务任务任务,java,camunda,Java,Camunda,首先我想说,我已经看到了这个问题:这个问题不是我的问题 我使用jersey构建了一个RESTAPI,并且使用了camunda工作流引擎 我使用了jersey quickstart grizzly maven archtype,然后定义了如下流程资源: @Path("process") public class Process { /** * Method handling HTTP GET requests. The returned object will be sent * to th
@Path("process")
public class Process {
/**
* Method handling HTTP GET requests. The returned object will be sent
* to the client as "text/plain" media type.
*
*/
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("start")
public void start(){
ProcessEngineManager.getEngine().getRuntimeService().startProcessInstanceByKey("test");
}
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("next")
public void next(@FormParam("name") String name){
Map<String,Object> formParams = new HashMap<>();
formParams.put("name",name);
ProcessEngineManager.getEngine().getFormService().submitTaskForm("testtask",formParams);
}
}
我在src/main/resources/workflowtest下定义了test.bpmn,如下所示:
在Xml中:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
<bpmn:process id="test" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>SequenceFlow_1v6clcy</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="SequenceFlow_1v6clcy" sourceRef="StartEvent_1" targetRef="testtask" />
<bpmn:userTask id="testtask" name="testtask" camunda:formKey="testform">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="name" label="name" type="string" />
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1v6clcy</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_07kdfp4</bpmn:outgoing>
</bpmn:userTask>
<bpmn:endEvent id="EndEvent_0vm605w">
<bpmn:incoming>SequenceFlow_07kdfp4</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_07kdfp4" sourceRef="testtask" targetRef="EndEvent_0vm605w" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="test">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="173" y="102" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1v6clcy_di" bpmnElement="SequenceFlow_1v6clcy">
<di:waypoint xsi:type="dc:Point" x="209" y="120" />
<di:waypoint xsi:type="dc:Point" x="275" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="242" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="UserTask_1s01hea_di" bpmnElement="testtask">
<dc:Bounds x="275" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0vm605w_di" bpmnElement="EndEvent_0vm605w">
<dc:Bounds x="437" y="101" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="455" y="141" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_07kdfp4_di" bpmnElement="SequenceFlow_07kdfp4">
<di:waypoint xsi:type="dc:Point" x="375" y="120" />
<di:waypoint xsi:type="dc:Point" x="403" y="120" />
<di:waypoint xsi:type="dc:Point" x="403" y="119" />
<di:waypoint xsi:type="dc:Point" x="437" y="119" />
<bpmndi:BPMNLabel>
<dc:Bounds x="418" y="113.5" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
序列流_1v6clcy
序列流_1v6clcy
SequenceFlow_07kdfp4
SequenceFlow_07kdfp4
我在src/main/resources下定义了camunda.cfg.xml,如下所示:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration"
class="org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<property name="databaseSchemaUpdate" value="true" />
</bean>
</beans>
我正在使用curl测试我的api,我验证了curl-xposthttp://localhost:8080/process/start
工作并启动一个进程,然后我执行curl-xpost-d'{name:“John”}'http://localhost:8080/process/next
我在服务器控制台中看到此异常:
org.camunda.bpm.engine.exception.NullValueException:找不到任务
id为testtask的:任务在
sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
约[?:1.8.0_151]at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
约[?:1.8.0_151]at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
约[?:1.8.0_151]at
newInstance(Constructor.java:423)
约[?:1.8.0_151]at
org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:344)
~[camunda-engine-7.8.0.jar:7.8.0]at
org.camunda.bpm.engine.impl.util.EnsureUtil.ensurentnull(EnsureUtil.java:49)
~[camunda-engine-7.8.0.jar:7.8.0]at
org.camunda.bpm.engine.impl.util.EnsureUtil.ensurentnull(EnsureUtil.java:44)
~[camunda-engine-7.8.0.jar:7.8.0]at
org.camunda.bpm.engine.impl.cmd.SubmitTaskFormCmd.execute(SubmitTaskFormCmd.java:54)
~[camunda-engine-7.8.0.jar:7.8.0]at
org.camunda.bpm.engine.impl.interceptor.CommandExecuteImpl.execute(commandExecuteImpl.java:24)
~[camunda-engine-7.8.0.jar:7.8.0]at
org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
~[camunda-engine-7.8.0.jar:7.8.0]at
org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
~[camunda-engine-7.8.0.jar:7.8.0]at
org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
~[camunda-engine-7.8.0.jar:7.8.0]at
org.camunda.bpm.engine.impl.FormServiceImpl.submitTaskForm(FormServiceImpl.java:88)
~[camunda-engine-7.8.0.jar:7.8.0]at
workflowtest.Process.next(Process.java:37)~[classes/:?]at
sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
约[?:1.8.0_151]at
invoke(NativeMethodAccessorImpl.java:62)
约[?:1.8.0_151]at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
位于java.lang.reflect.Method.invoke(Method.java:498)的~[?:1.8.0151]
约[?:1.8.0_151]at
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
~[jersey-server-2.26.jar:?]at
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$voidOutingVoker.doDispatch(JavaResourceMethodDispatcherProvider.java:183)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
[jersey-common-2.26.jar:?]at
org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
[jersey-common-2.26.jar:?]at
org.glassfish.jersey.internal.Errors.process(Errors.java:316)
[jersey-common-2.26.jar:?]at
org.glassfish.jersey.internal.Errors.process(Errors.java:298)
[jersey-common-2.26.jar:?]at
org.glassfish.jersey.internal.Errors.process(Errors.java:268)
[jersey-common-2.26.jar:?]at
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
[jersey-common-2.26.jar:?]at
org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703)
[jersey-server-2.26.jar:?]at
org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:377)
[jersey-container-grizzly2-http-2.26.jar:?]
org.glassfish.grizzly.http.server.HttpHandler$1.ru
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration"
class="org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<property name="databaseSchemaUpdate" value="true" />
</bean>
</beans>