我已经创建了远程REST API客户端,但是我遇到了错误,而它在jBPM控制台上正常运行但是REST有这样的问题
[main] ERROR org.kie.services.client.api.command.AbstractRemoteCommandObject - 返回状态为200的响应。 线程“main”中的异常org.kie.remote.client.api.exception.RemoteApiException:抛出带有消息'[Transport.Performance:207 - :5]的WorkflowRuntimeException - 尝试评估split中的约束时出现异常': org.kie.remote.services.rest.exception.KieRemoteRestOperationException:[Transport.Performance:207 - :5] - 尝试评估split中的约束时的异常
这是我的代码
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());
}
}
任何人都可以提供帮助? 谢谢
答案 0 :(得分:0)
我从未见过这个错误,但几周前,当我将jBPM版本从6.2升级到6.3时,我遇到了jBPM REST API的问题。我解决了它为所有需要使用REST API的用户添加“rest-all”角色(在你的情况下就像“krisv”)。你能试试吗?
问候。