AnsweredAssumed Answered

REST API list completed tasks

Question asked by dvdschyff on Oct 24, 2012
Latest reply on Oct 24, 2012 by jpfi
Hi

I am working on a dashlet that wil list completed tasks.
I can use the rest api to retrieve in progress tasks, but when I try to get completed tasks I get an exception.

This request: api/task-instances?state=completed
generates the following response:
{
    "status" :
  {
    "code" : 500,
    "name" : "Internal Error",
    "description" : "An error inside the HTTP server which prevented it from fulfilling the request."
  }, 
 
  "message" : "09240056 Wrapped Exception (with status template): null", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 09240056 Wrapped Exception (with status template): null",
 
  "callstack" :
  [
       ""      ,"java.lang.NullPointerException"
      ,"org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine$3.apply(ActivitiWorkflowEngine.java:1177)"
      ,"org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine$3.apply(ActivitiWorkflowEngine.java:1170)"
      ,"org.alfresco.repo.workflow.WorkflowObjectFactory$1.apply(WorkflowObjectFactory.java:374)"
      ,"org.alfresco.repo.workflow.WorkflowObjectFactory$1.apply(WorkflowObjectFactory.java:371)"
      ,"org.alfresco.util.collections.CollectionUtils$2.apply(CollectionUtils.java:131)"
      ,"org.alfresco.util.collections.CollectionUtils.transform(CollectionUtils.java:77)"
      ,"org.alfresco.util.collections.CollectionUtils.filter(CollectionUtils.java:127)"
      ,"org.alfresco.repo.workflow.WorkflowObjectFactory.filterByDomain(WorkflowObjectFactory.java:370)"
      ,"org.alfresco.repo.workflow.activiti.ActivitiTypeConverter.filterByDomainAndConvert(ActivitiTypeConverter.java:98)"
      ,"org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.getValidHistoricTasks(ActivitiWorkflowEngine.java:1169)"
      ,"org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.queryHistoricTasks(ActivitiWorkflowEngine.java:1854)"
      ,"org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.queryTasks(ActivitiWorkflowEngine.java:1562)"
      ,"org.alfresco.repo.workflow.WorkflowServiceImpl.queryTasks(WorkflowServiceImpl.java:755)"
      ,"sun.reflect.GeneratedMethodAccessor1492.invoke(Unknown Source)"
      ,"sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)"
      ,"java.lang.reflect.Method.invoke(Method.java:597)"
      ,"org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)"
      ,"org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)"
      ,"org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)"
      ,"org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)"
      ,"org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)"
      ,"org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)"
      ,"org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)"
      ,"org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)"
      ,"org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)"
      ,"org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)"
      ,"org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)"
      ,"org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)"
      ,"$Proxy71.queryTasks(Unknown Source)"
      ,"org.alfresco.repo.web.scripts.workflow.TaskInstancesGet.buildModel(TaskInstancesGet.java:158)"
      ,"org.alfresco.repo.web.scripts.workflow.AbstractWorkflowWebscript.executeImpl(AbstractWorkflowWebscript.java:80)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:393)"
      ,"org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)"
      ,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)"
      ,"javax.servlet.http.HttpServlet.service(HttpServlet.java:717)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)"
      ,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)"
      ,"org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)"
      ,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)"
      ,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)"
      ,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)"
      ,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)"
      ,"org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)"
      ,"org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)"
      ,"org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)"
      ,"java.lang.Thread.run(Thread.java:662)"
      ,"org.springframework.extensions.webscripts.WebScriptException: 09240056 Wrapped Exception (with status template): null"
      ,"org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)"

  ],
 
  "server" : "Community v4.0.0 (7) schema 5,025",
  "time" : "24 Oct 2012 10:36:32 AM"
}


It seems like the exception only happens when the results include a task, part of an advanced workflow, I created.

retrieving the list of completed workflow instances also generates an exception
api/workflow-instances?state=completed
{
    "status" :
  {
    "code" : 500,
    "name" : "Internal Error",
    "description" : "An error inside the HTTP server which prevented it from fulfilling the request."
  }, 
 
  "message" : "09240061 Wrapped Exception (with status template): null", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 09240061 Wrapped Exception (with status template): null",
 
  "callstack" :
  [
       ""      ,"java.lang.NullPointerException"
      ,"org.alfresco.repo.web.scripts.workflow.WorkflowModelBuilder.buildSimple(WorkflowModelBuilder.java:237)"
      ,"org.alfresco.repo.web.scripts.workflow.WorkflowInstancesGet.buildModel(WorkflowInstancesGet.java:125)"
      ,"org.alfresco.repo.web.scripts.workflow.AbstractWorkflowWebscript.executeImpl(AbstractWorkflowWebscript.java:80)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:393)"
      ,"org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)"
      ,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)"
      ,"javax.servlet.http.HttpServlet.service(HttpServlet.java:717)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)"
      ,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)"
      ,"org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)"
      ,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)"
      ,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)"
      ,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)"
      ,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)"
      ,"org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)"
      ,"org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)"
      ,"org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)"
      ,"java.lang.Thread.run(Thread.java:662)"
      ,"org.springframework.extensions.webscripts.WebScriptException: 09240061 Wrapped Exception (with status template): null"
      ,"org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)"

  ],
 
  "server" : "Community v4.0.0 (7) schema 5,025",
  "time" : "24 Oct 2012 10:43:07 AM"
}


I am using Alfresco Community 4.0e

any suggestions would be helpful

Outcomes