I am trying to do a simple call to JBPM REST API. Doing a GET request via Postman works as expected, for example:
http://localhost:8080/jbpm-console/rest/task/query?potentialOwner=krisv&language=en-UK
returns 3 tasks back.
Then I tried to do a simple java client using JBPM Remote Java API but server is returning NotFoundException (NullPointer exception thrown on client). Code is pretty much copy pasted from JBPM docs:
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");
Server log:
2015-09-09 09:26:10,516 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-46) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/jbpm-console/rest/task/execute
This is not even the REST endpoint that should be called, seems like it is internally executed and fails?? I have absolutely no idea what is wrong.
I am using the demo evaluation project so it can be easily reproducible.
As always you find a solution as soon as you post on SO..
The problem was that I was reading documentation for JBPM 6.1.0 but I was using JBPM 6.2.0. I have included kie-service-client 6.1.0 in my pom.xml but what I should have had is kie-remote-client 6.2.0. Then, following the slightly different 6.2.0 example: https://docs.jboss.org/jbpm/v6.2/userguide/jBPMRemoteAPI.html it started working.