AnsweredAssumed Answered

[REST] complete Task - NullPointerException

Question asked by mokematt on Jun 20, 2012
Latest reply on Aug 23, 2012 by pneudecorb
Hi everybody,

i've installed the activiti engine with MySQL and wanted to test the examples. I've started a Process with the ProcessInstanceId: adhoc_Expense_process:1:25 from the examples. When i now list all my tasks i get a new task with the id 213:
{
  size: 1,
  total: 1,
  data: [
    {
      name: "Request expense refund",
      id: "213",
      priority: 50,
      owner: null,
      description: "Request the refund of an expense
            related to company business.",
      assignee: "pucco",
      delegationState: null,
      processInstanceId: "210",
      executionId: "210",
      processDefinitionId: "adhoc_Expense_process:1:25",
      createTime: "2012-06-20T09:21:27CEST",
      taskDefinitionKey: "task_1",
      dueDate: null,
      parentTaskId: null,
      formResourceKey: null,
      subTaskList: [],
      identityLinkList: [],
      attachmentList: []
    }
  ],
  start: 0,
  order: "asc",
  sort: "id"
}

Then i want to complete the Task and send this rest request:
PUT /activiti-rest/service/task/213/complete HTTP/1.1
Host: localhost
Content-type: application/json
Authorization: Basic cHVjY286TmFzZTEyMys=
Content-Length: 60
Connection: close
{"Amount":"1337","Motivation":"ActivitiEngine should work!"}

But i get a 500 HTTP error with the message: "Did not receive the operation parameters"
In the log file "catalina.out" i see this message according to the request:
Jun 20, 2012 10:14:08 AM org.restlet.resource.UniformResource doCatch
WARNING: Exception or error caught in resource
org.activiti.engine.ActivitiException: Did not receive the operation parameters
        at org.activiti.rest.api.task.TaskOperationResource.executeTaskOperation(TaskOperationResource.java:65)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:446)
        at org.restlet.resource.ServerResource.put(ServerResource.java:1170)
        at org.restlet.resource.ServerResource.doHandle(ServerResource.java:521)
        at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:587)
        at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:299)
        at org.restlet.resource.ServerResource.handle(ServerResource.java:846)
        at org.restlet.resource.Finder.handle(Finder.java:510)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Router.doHandle(Router.java:497)
        at org.restlet.routing.Router.handle(Router.java:737)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:151)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.engine.ChainHelper.handle(ChainHelper.java:111)
        at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:72)
        at org.restlet.Application.handle(Application.java:388)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Router.doHandle(Router.java:497)
        at org.restlet.routing.Router.handle(Router.java:737)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.routing.Router.doHandle(Router.java:497)
        at org.restlet.routing.Router.handle(Router.java:737)
        at org.restlet.routing.Filter.doHandle(Filter.java:156)
        at org.restlet.routing.Filter.handle(Filter.java:203)
        at org.restlet.engine.ChainHelper.handle(ChainHelper.java:111)
        at org.restlet.Component.handle(Component.java:387)
        at org.restlet.Server.handle(Server.java:488)
        at org.restlet.engine.ServerHelper.handle(ServerHelper.java:71)
        at org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:150)
        at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1037)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
        at org.activiti.rest.api.task.TaskOperationResource.executeTaskOperation(TaskOperationResource.java:41)
        … 58 more
Jun 20, 2012 10:14:08 AM org.restlet.engine.log.LogFilter afterHandle
INFO: 2012-06-20        10:14:08        127.0.0.1       pucco   127.0.0.1       80      PUT     /activiti-rest/service/task/213/complete        -       500433      -       72      http://localhost        -       -

Why is there this exeption caused by a NullPointerException? There exists a task with the id 213.
Are there any other log files that could be helpful solving this problem?

thanks a lot for help

Outcomes