2 Replies Latest reply on Mar 10, 2014 2:50 PM by Matteo Maguolo

    remote java API - simple example

    Matteo Maguolo Newbie

      Hi to all,

      I am tryng to execute the base example (from documentation user guide 6.0.1), with jbpom 6.0.1, this is the code:

       

      public static void main(String[] args) throws MalformedURLException {

        // Setup the factory class with the necessary information to communicate with the REST services

        RemoteRestRuntimeFactory restSessionFactory = new RemoteRestRuntimeFactory("org.jbpm:Evaluation:1.0", new URL("http://localhost:8080/jbpm-console/"), "krisv","krisv");

        // Create KieSession and TaskService instances and use them

        RuntimeEngine engine = restSessionFactory.newRuntimeEngine();

        KieSession ksession = engine.getKieSession();

        ProcessInstance processInstance = ksession.startProcess("evaluation");

        long procId = processInstance.getId();

        String taskUserId = "krisv";

        TaskService taskService = engine.getTaskService();

        List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("krisv", "en-UK");

        long taskId = -1;

        for( TaskSummary task : tasks ) {

           if( task.getProcessInstanceId() == procId ) {

               taskId = task.getId();

           }

        }

        if( taskId == -1 ) {

           throw new IllegalStateException("Unable to find task for " + "krisv" + " in process instance " + procId );

      }

       

        taskService.start(taskId, taskUserId);

        }

       

       

      but I get this response from Eclipse:

       

      Exception in thread "main" java.lang.RuntimeException: DomainNotFoundBadRequestException thrown with message 'No runtime manager could be found for deployment 'org.jbpm:Evaluation:1.0'.'

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

        at org.kie.services.client.api.command.AbstractRemoteCommandObject.execute(AbstractRemoteCommandObject.java:110)

        at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:232)

        at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:223)

        at com.sample.ProcessMain.main(ProcessMain.java:46)

       

      the error remind me at the line   "ProcessInstance processInstance = ksession.startProcess("evaluation");