我正在尝试对 JBPM REST API 进行简单的调用。通过 Postman 执行 GET 请求可以按预期工作,例如:
http://localhost:8080/jbpm-console/rest/task/query?potentialOwner=krisv&language=en-UK
返回 3 个任务。
然后我尝试使用 JBPM Remote Java API 做一个简单的 java 客户端,但服务器返回 NotFoundException(客户端抛出 NullPointer 异常)。代码几乎是从 JBPM 文档复制粘贴的:
URL instanceUrl = new URL("http://localhost:8080/jbpm-console/");
String deploymentId = "org.jbpm:Evaluation:1.0";
String processDefId = "evaluation";
String user = "krisv";
String password = "krisv";
// Setup the factory class with the necessarry information to communicate with the REST services
RemoteRuntimeEngineFactory restSessionFactory =
new RemoteRestRuntimeEngineFactory(deploymentId, instanceUrl, user, password);
// Create KieSession instance
RemoteRuntimeEngine engine = restSessionFactory.newRuntimeEngine();
KieSession ksession = engine.getKieSession();
TaskService taskService = engine.getTaskService();
taskService.getTasksAssignedAsPotentialOwner("krisv", "en-UK");
服务器日志:
2015-09-09 09:26:10,516 警告 [org.jboss.resteasy.core.ExceptionHandler](默认任务 46)执行失败:javax.ws.rs.NotFoundException:找不到完整路径的资源:http://localhost:8080/jbpm-console/rest/task/execute
这甚至不是应该调用的 REST 端点,看起来它是在内部执行的并且失败了?我完全不知道出了什么问题。
我正在使用演示评估项目,因此可以轻松重现它。
最佳答案
一如既往,您一在 SO 上发帖就会找到解决方案..
问题是我正在阅读 JBPM 6.1.0 的文档,但我正在使用 JBPM 6.2.0。我已将 kie-service-client 6.1.0 包含在我的 pom.xml 中,但我应该拥有的是 kie-remote-client 6.2.0。然后,按照略有不同的 6.2.0 示例:https://docs.jboss.org/jbpm/v6.2/userguide/jBPMRemoteAPI.html它开始工作了。
关于java - 对 JBPM REST API 进行简单调用时出现 NotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32473610/