camunda找不到id任务的任务为null

时间:2017-03-28 08:24:29

标签: bpmn camunda

我是Camunda的初学者。我想完成一项任务。 所以我通过调用:

来启动一个实例
http://localhost:8080/engine-rest/process-definition/key/approve-loan/submit-form

通过Postman和POST请求以及以下数据:

{
  "variables": {
    "customerId": {"value":"Niall","type":"String"},
    "amount":{"value":"100","type":"String"}
  }
}

Content-Type : application/json

我有以下输出:

{
  "links": [
    {
      "method": "GET",
      "href": "http://localhost:8080/engine-rest/process-instance/3f219a2a-138e-11e7-b49e-104a7ddf1366",
      "rel": "self"
    }
  ],
  "id": "3f219a2a-138e-11e7-b49e-104a7ddf1366",
  "definitionId": "approve-loan:2:8cd1ab3c-1303-11e7-b49e-104a7ddf1366",
  "businessKey": null,
  "caseInstanceId": null,
  "ended": false,
  "suspended": false,
  "tenantId": null
}

我查看了camunda博客,发现我可以通过调用(POST请求)完成任务实例: http://localhost:8080/engine-rest/task/3f219a2a-138e-11e7-b49e-104a7ddf1366/complete 问题是,由于我有以下回应,因此无效:

{
  "type": "RestException",
  "message": "Cannot complete task 3f219a2a-138e-11e7-b49e-104a7ddf1366: Cannot find task with id 3f219a2a-138e-11e7-b49e-104a7ddf1366: task is null"
}

和tomcat控制台中的这个异常:

Caused by: org.camunda.bpm.engine.exception.NullValueException: Cannot find task with id 3f219a2a-138e-11e7-b49e-104a7ddf1366: task is null
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:334)
        at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:49)
        at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:44)
        at org.camunda.bpm.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:47)
        at org.camunda.bpm.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:30)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
        at org.camunda.bpm.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:170)
        at org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.complete(TaskResourceImpl.java:95)
        ... 37 more

我致电http://localhost:8080/engine-rest/task/?processInstanceId=3f219a2a-138e-11e7-b49e-104a7ddf1366 得到属性和响应是

[
  {
    "id": "3f220f63-138e-11e7-b49e-104a7ddf1366",
    "name": "Approve Loan",
    "assignee": "john",
    "created": "2017-03-28T10:12:12",
    "due": null,
    "followUp": null,
    "delegationState": null,
    "description": null,
    "executionId": "3f219a2a-138e-11e7-b49e-104a7ddf1366",
    "owner": null,
    "parentTaskId": null,
    "priority": 50,
    "processDefinitionId": "approve-loan:2:8cd1ab3c-1303-11e7-b49e-104a7ddf1366",
    "processInstanceId": "3f219a2a-138e-11e7-b49e-104a7ddf1366",
    "taskDefinitionKey": "UserTask_11fud4o",
    "caseExecutionId": null,
    "caseInstanceId": null,
    "caseDefinitionId": null,
    "suspended": false,
    "formKey": "embedded:app:forms/approve-loan.html",
    "tenantId": null
  }
]

我使用了idexecutionId,但我仍然收到错误。

请帮忙吗?

1 个答案:

答案 0 :(得分:1)

感谢@Zelldon: 工作网址为http://localhost:8080/engine-rest/task/3f220f63-138e-11e7-b49e-104a7ddf1366/complete

我只需要在调用http://localhost:8080/engine-rest/task/?processInstanceId=3f219a2a-138e-11e7-b49e-104a7ddf1366

之后获取响应中的id

请将其标记为已解决,因为我无法解决。