camunda 找不到 ID 任务为空的任务

camunda Cannot find task with id task is null

我是 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 但我仍然遇到错误。

有什么帮助吗?

感谢@Zelldon: 工作 URL 是 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

请将其标记为已解决,因为我不能。