cancel
Showing results for 
Search instead for 
Did you mean: 

[REST] complete Task - NullPointerException

mokematt
Champ in-the-making
Champ in-the-making
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
4 REPLIES 4

pneudecorb
Champ in-the-making
Champ in-the-making
I am receiving the same error as well.  The Representation "entity" parameter on the restful TaskOperationResource.executeTaskOperation is null and the code is dereferencing which causes a NullPointerException.

I've seen a few post about this back in June, but no responses from the community as to the cause or how to address this with a code or configuration change.

Is this a bug?  I am running version 5.10.

Thanks,
Pneu

pneudecorb
Champ in-the-making
Champ in-the-making
I just noticed that this was patched recently in 5.10 code. 

Anybody know if the public jars are reflective of these recent code fixes to 5.10?

pneudecorb
Champ in-the-making
Champ in-the-making
I misspoke in my previous post.  The issue is not been addressed on the trunk.

Anybody on the forum know why the TaskOperationResource.executeTaskOperation(..)'s Representation argument would be null?

P

pneudecorb
Champ in-the-making
Champ in-the-making
This issue was solved thanks to Tijs help.  The problem was that the request body needs to be empty (e.g., {}) for the parameter to come in non-null, even though the request body is really not required for this request.

Tijs mention he is going to be fixing this issue.