AnsweredAssumed Answered

Problems starting process-instance via REST

Question asked by gant on Feb 5, 2011
Latest reply on Feb 5, 2011 by frederikheremans1
Hi,

I¨m trying to start a process-instance via REST.


public void startProcessInstance(String processDefinitionId, Object processVariable) {
      
      JSONObject requestObject = new JSONObject();
      requestObject.put("processDefinitionId", "AdhocTaskProcess:1");
      requestObject.put("processVariable", processVariable);

      // TODO Handling RestClientException
      login();
      template.postForEntity("http://localhost:15000/activiti-rest/service/process-instance", requestObject, JSONObject.class);
      
   }

private void login(){
   Credentials credentials = new UsernamePasswordCredentials("kermit", "kermit");

   CommonsClientHttpRequestFactory factory = (CommonsClientHttpRequestFactory) template.getRequestFactory();
   HttpClient client = factory.getHttpClient();

   client.getState().setCredentials(AuthScope.ANY, credentials);
}

This causes the following exception:


16:17:01,719  ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status templat
e error: 01050001 Wrapped Exception (with status template): no deployed process definition found with id 'AdhocTaskProce
ss:1'
org.springframework.extensions.webscripts.WebScriptException: 01050001 Wrapped Exception (with status template): no depl
oyed process definition found with id 'AdhocTaskProcess:1'
        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:742)

        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:167)
        at org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:69)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
        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:857)
        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: org.activiti.engine.ActivitiException: no deployed process definition found with id 'AdhocTaskProcess:1'
        at org.activiti.engine.impl.db.DbRepositorySession.findDeployedProcessDefinitionById(DbRepositorySession.java:18
1)
        at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:47)
        at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:29)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:22)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:37)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceById(RuntimeServiceImpl.java:69)
        at org.activiti.rest.api.process.ProcessInstancePost.executeWebScript(ProcessInstancePost.java:49)
        at org.activiti.rest.util.ActivitiWebScript.executeImpl(ActivitiWebScript.java:68)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)
        … 17 more

Seems, there is no matching process-definition deployed. But, I can see a Version 1 of "AdhocTaskProcess" in Activiti-Probe, and I can start an instance of this via Activiti-Explorer…

Here is the result of an SQL-Query on my Activiti-Database:


(ID_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, HAS_START_FORM_KEY_) VALUES
  ('AdhocTaskProcess:1:815', 'http://www.signavio.com/bpmn20', 'AdhocTaskProcess', 'AdhocTaskProcess', 1, '810', 'AdhocTaskProcess.bpmn20.xml', 'AdhocTaskProcess.AdhocTaskProcess.png', 0),

Has anybody hints for me?

Regards
michael

Outcomes