3 Replies Latest reply on Jan 12, 2015 9:50 PM by wesleychen

    Start process error

    wesleychen

      Hi All,

      jbpm-console.png

      I am starting an HR sample process of jbpm-console, but get error as below. Can you help me? Thanks.

       

      SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

      SLF4J: Defaulting to no-operation (NOP) logger implementation

      SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

      Exception in thread "main" java.lang.NoSuchMethodError: org.kie.services.client.serialization.jaxb.impl.JaxbCommandsRequest.setUser(Ljava/lang/String;)V

        at org.kie.services.client.api.command.AbstractRemoteCommandObject.prepareCommandRequest(AbstractRemoteCommandObject.java:196)

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

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

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

        at com.sample.TestjBPM.test(TestjBPM.java:48)

        at com.sample.TestjBPM.main(TestjBPM.java:26)

       

      Code:

       

      public class TestjBPM {

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

       

        try {

        // /maven2/com/test/1.0/test-1.0.jar

        new TestjBPM().test("org.jbpm:HR:1.0", new URL("http://localhost:8080/jbpm-console"), "krisv", "krisv");

        } catch (MalformedURLException e) {

        // TODO Auto-generated catch block

        e.printStackTrace();

        }

        }

       

        public void test(String deploymentId, URL deploymentUrl, String user, String password) {

         // Create REST session

       

       

         RemoteRestSessionFactory restSessionFactory

           = new RemoteRestSessionFactory(deploymentId, deploymentUrl, user, password);

         RuntimeEngine engine = restSessionFactory.newRuntimeEngine();

         KieSession ksession = engine.getKieSession();

               Map<String, Object> params = new HashMap<String, Object>();

               params.put("name", "johny");        

               ProcessInstance processInstance = ksession.startProcess("hiring", params);     // error

               processInstance.getProcessId();

      //  ProcessInstance processInstance = ksession.startProcess("process_1");

       

       

      Regards,

      Wesley Chen

        • 1. Re: Start process error
          salaboy21

          Can you try with this project -> https://github.com/droolsjbpm/jbpm-playground/blob/master/jbpm-simple-rest-client/src/main/java/org/jbpm/simple/rest/client/SimpleRestClient.java

           

          Make sure that you have the correct dependencies in your class path, because it seems that you are missing something or you have the wrong version.

           

          Regards

          1 of 1 people found this helpful
          • 2. Re: Re: Start process error
            wesleychen

            I have tried with this project, but I cannot find kie-services-client-6.1.0-SNAPSHOT.jar file, so I use kie-services-client-6.1.0-Final.jar.

             

            Can you help me? Thanks.

            It still appear error as below.

             

            SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

            SLF4J: Defaulting to no-operation (NOP) logger implementation

            SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

            Exception in thread "main" java.lang.NoSuchMethodError: org.kie.services.client.serialization.jaxb.impl.JaxbCommandsRequest.setVersion(Ljava/lang/String;)V

            at org.kie.services.client.api.command.AbstractRemoteCommandObject.prepareCommandRequest(AbstractRemoteCommandObject.java:197)

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

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

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

            at org.jbpm.simple.rest.client.SimpleRestClient.main(SimpleRestClient.java:47)

             

            pom.xml:

             

            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
                <modelVersion>4.0.0</modelVersion>

                <groupId>org.jbpm</groupId>
                <artifactId>jbpm-simple-rest-client</artifactId>
                <version>1.0-Final</version>
                <packaging>jar</packaging>

                <name>jBPM :: Simple Rest Client Example</name>
              

                <properties>
                    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                </properties>
               
                <dependencies>
              <dependency>
                   <groupId>org.jbpm</groupId>
                   <artifactId>jbpm-test</artifactId>
                   <version>6.1.0.Final</version>
                 </dependency>
                </dependencies>
             
                <repositories>
                    <repository>
                        <id>jboss</id>
                        <url>http://repository.jboss.org/nexus/content/groups/public/</url>
                    </repository>
                </repositories>
            </project>

             

            SimpleRestClient .java:

             

            package org.jbpm.simple.rest.client;

            import java.net.MalformedURLException;
            import java.net.URL;
            import java.util.HashMap;
            import java.util.List;
            import java.util.Map;
            import org.jbpm.process.audit.AuditLogService;
            import org.jbpm.process.audit.ProcessInstanceLog;
            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.services.client.api.RemoteRestRuntimeFactory;
            import org.kie.services.client.api.command.RemoteRuntimeEngine;
            /**
            * This is a very simple Rest Client to test against a running
            *  instance of the KIE Workbench. 
            * You can parameterize
            *   - the Deployment Unit Id
            *   - the Application URL
            *   - the user/pass to execute operations
            */
            public class SimpleRestClient 
            {
                public static void main( String[] args ) throws MalformedURLException
                {
                    String deploymentId = "org.jbpm:human-resources:1.0";
                    URL appUrl = new URL("http://localhost:8080/kie-wb/");
                    String user = "jbpm";
                    String password = "jbpm6";
                    RemoteRestRuntimeFactory restSessionFactory  = new RemoteRestRuntimeFactory(deploymentId, appUrl, user, password);

                    RemoteRuntimeEngine engine = restSessionFactory.newRuntimeEngine();

                    KieSession ksession = engine.getKieSession();

                    TaskService taskService = engine.getTaskService();

                    AuditLogService auditLogService = engine.getAuditLogService();

                    Map<String, Object> params = new HashMap<String, Object>();

                    params.put("candidate", "johny");

                    ProcessInstance processInstance = ksession.startProcess("hiring", params);     // error

                    // do some more interactions here... for example try the Human Task APIs
                    // List<TaskSummary> tasksAssignedAsPotentialOwner = taskService.getTasksAssignedAsPotentialOwner("jbpm", "en-UK");

                    List<ProcessInstanceLog> findProcessInstances = auditLogService.findProcessInstances();

                    for(ProcessInstanceLog pi : findProcessInstances){

                        System.out.println("Process Instance: "+pi.getProcessName() + " - Version: "+pi.getProcessVersion() + " - Started at: "+pi.getStart());

                    }
                }
            }

            • 3. Re: Start process error
              wesleychen

              Hi All,

               

              Who can help me? Thanks in advance.

               

              Regards,

              Wesley Chen