1 Reply Latest reply on Aug 28, 2017 11:55 PM by Ripin Yan

    Java Rest API for JBPM 7

    yellapu sony Newbie

      Hello All,

       

      I am trying to execute the workflows of JBPM 7.0.0 Final  using java rest API( through  kie-remote client  ).Below is the piece of code i used :

       

      import org.kie.api.runtime.KieSession;

      import org.kie.api.runtime.manager.RuntimeEngine;

      import org.kie.api.runtime.manager.RuntimeManager;

      import org.kie.api.runtime.process.ProcessInstance;

      import org.kie.remote.client.api.RemoteRuntimeEngineFactory;

       

      RuntimeEngine engine =

      RemoteRuntimeEngineFactory.newRestBuilder().addUrl(new URL("http://192.168.175.161:8080/jbpm-console")).addUserName("admin").addPassword("admin").addDeploymentId("ScriptTaskProject_1.0.0").addTimeout(0).build();

      KieSession ksession = engine.getKieSession();

        ProcessInstance processInstance=ksession.startProcess("ScriptTaskProject.ScriptTaskProcess");

      System.out.println("***** Process instance:"+processInstance.getId());

      In the above java code,I used kie-remote-client-6.5.0.Final jar. It works fine till JBPM 6.5.0 Final, but giving below nullpointer exception when trying to execute workflow in jbpm7.0.0 final

       

      Below is the stack trace :

      org.kie.remote.client.api.exception.RemoteCommunicationException: Unable to retrieve content from response!

        at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeRestCommand(AbstractRemoteCommandObject.java:427)

        at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeCommand(AbstractRemoteCommandObject.java:128)

        at org.kie.services.client.api.command.KieSessionClientCommandObject.getFactCount(KieSessionClientCommandObject.java:241)

        at SampleWorkFlowTrigger.main(SampleWorkFlowTrigger.java:37)

      Caused by: java.lang.NullPointerException

        at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeRestCommand(AbstractRemoteCommandObject.java:410)

        ... 3 more

       

      Am i doing anything wrong or is there any new way of using java rest API in JBPM 7.0.0 final ?

       

      Thanks in advance !!.