AnsweredAssumed Answered

Error in Complete Task using Rest

Question asked by sarkar92 on Dec 7, 2012
Latest reply on Dec 10, 2012 by jbarrez
I am using Activiti in Action's Example to complete vactaion request task using rest.

my complete task code is
public static String completeHandleVacationRequestTask(String taskId)
         throws Exception {
      String uri = REST_URI + "/task/" + taskId + "/complete";
      Representation response = getClientResource(uri).put(
            "{vacationApproved:true}", MediaType.APPLICATION_JSON);
      JSONObject object = new JSONObject(response.getText());
      logger.info("Completed task " + taskId + " " + object.getString("success"));
      return object.getString("success");
   }

but it gives an error and unable to copmlete the task….
the error log

INFO: 2012-12-07   15:26:35   127.0.0.1   kermit   127.0.0.1   9090   GET   /activiti-rest/service/tasks   assignee=kermit   200   -   -   124   http://localhost:9090   Restlet-Framework/2.0snapshot   -
Dec 07, 2012 3:26:35 PM 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:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   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:722)
Caused by: org.codehaus.jackson.JsonParseException: Unexpected character ('n' (code 110)): was expecting double-quote to start field name
at [Source: java.io.StringReader@158fa79; line: 1, column: 3]
   at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:929)
   at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
   at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
   at org.codehaus.jackson.impl.ReaderBasedParser._handleUnusualFieldName(ReaderBasedParser.java:342)
   at org.codehaus.jackson.impl.ReaderBasedParser._parseFieldName(ReaderBasedParser.java:235)
   at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:125)
   at org.codehaus.jackson.map.deser.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:163)
   at org.codehaus.jackson.map.deser.BaseNodeDeserializer.deserializeAny(JsonNodeDeserializer.java:190)
   at org.codehaus.jackson.map.deser.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:52)
   at org.codehaus.jackson.map.deser.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:13)
   at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:1282)
   at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:899)
   at org.codehaus.jackson.map.ObjectMapper.readTree(ObjectMapper.java:675)
   at org.activiti.rest.api.task.TaskOperationResource.executeTaskOperation(TaskOperationResource.java:42)
   … 58 more

please help …..

Outcomes