0
votes

I've created remote REST API client but I've got an error whereas it ran properly on jBPM console but REST having problem like this

[main] ERROR org.kie.services.client.api.command.AbstractRemoteCommandObject - Response with status 200 returned. Exception in thread "main" org.kie.remote.client.api.exception.RemoteApiException: WorkflowRuntimeException thrown with message '[Transport.Performance:207 - :5] -- Exception when trying to evaluate constraint in split ': org.kie.remote.services.rest.exception.KieRemoteRestOperationException: [Transport.Performance:207 - :5] -- Exception when trying to evaluate constraint in split

this is my code

 package org.transportclient;

 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import org.jbpm.workflow.instance.WorkflowRuntimeException;
 import org.kie.api.runtime.KieSession;
 import org.kie.api.runtime.manager.RuntimeEngine;
 import org.kie.api.runtime.process.ProcessInstance;
 import org.kie.api.task.TaskService;
 import org.kie.api.task.model.TaskSummary;
 import org.kie.remote.client.api.RemoteRuntimeEngineFactory;
 import org.kie.services.client.api.command.RemoteRuntimeException;  
 import org.kie.services.client.api.command.exception.RemoteApiException;

 public class TransportRest {
  public static void main(String[] args) throws MalformedURLException {
  RuntimeEngine engine = RemoteRuntimeEngineFactory.newRestBuilder()
  .addUrl(new URL("http://localhost:8080/jbpm-console"))
  .addUserName("krisv").addPassword("krisv")
  .addDeploymentId("RnD:transport:1.5.1")
  .build();
 KieSession ksession = engine.getKieSession();
 //TaskService taskService = engine.getTaskService();
 // start a new process instance
 Map<String, Object> params = new HashMap<String, Object>();
 params.put("entry_date", "04-22-2016 00:00:00");
 params.put("ne_id", "NY");
 params.put("ping_time","900");
 System.out.println(params);
 ProcessInstance processInstance =  ksession.startProcess("Transport.Performance", params);
 System.out.println(processInstance.getParentProcessInstanceId());
 System.out.println("Start Performance process " +       processInstance.getId());
    }
 }

Anyone can help ? Thank you

1

1 Answers

0
votes

I have never seen that error, but I had problems with jBPM REST API a few weeks ago when I upgraded jBPM version from 6.2 to 6.3. I solved it adding "rest-all" role to all users who need to use REST API (like "krisv" in your case"). Could you try this?

Regards.