4 Replies Latest reply on Jan 4, 2013 3:00 PM by roxy1987

    ProcessInstanceID not increment

    betoflint

      Dear, I have the following problem:

      I have jbpm 5.3 on jboss 7.0.2 with oracle, when I run the console process works perfectly, the id processInstanceId incorrect and also increase every time I run the process instance.

      The problem is that I need to do it now from the jbpm API creates the process in the task table with the correct ID, but the processInstanceId always 1. Is there any way to be increasing every time you generate a new instance to differentiate them so?

      Thnks!

       

      Estimados, tengo el siguiente problema:

      Tengo jbpm 5.3 sobre jboss 7.0.2 con oracle, cuando corro por consola los procesos funcionan perfectamente, los id son correctos y los processInstanceId tambien se incrementan cada vez que ejecuto la instancia de proceso.

      El problema es que necesito hacerlo ahora desde la api de jbpm, se crea el proceso en la tabla task con el id correcto, pero el processInstanceId siempre es 1. ¿Hay alguna forma de ir incrementando cada vez que genere una nueva instancia para asi poder diferenciarlos?

      Muchas gracias!

       

      El codigo asociado que estoy usando como ejemplo es el siguiente:

      The code:

       

      public void hola() {

      // TODO Auto-generated method stub

                                    //declaracion de variables

                                    KnowledgeRuntimeLogger logger;

                                    HornetQHTWorkItemHandler hornetQHTWorkItemHandler;

                                    TaskService taskClient;

                                    //StatefulKnowledgeSession ksession;

                                    //carga la base de conocimientos

                                    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

                                    kbuilder.add(ResourceFactory.newClassPathResource("resources/HumanTask.bpmn"), ResourceType.BPMN2);

                                    KnowledgeBase kbase = kbuilder.newKnowledgeBase();

                                    //Se define el kasession que podra acceder a mis procesos definidos anteriormente

                                    StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

       

                                    logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "test", 1000);

                       

                                    //hornetQHTWorkItemHandler = new HornetQHTWorkItemHandler(ksession);

                                    CommandBasedHornetQWSHumanTaskHandler taskHandler = new CommandBasedHornetQWSHumanTaskHandler(ksession);

       

                                    ksession.getWorkItemManager().registerWorkItemHandler("Human Task", taskHandler);

                       

                                    taskClient = new SyncTaskServiceWrapper(new AsyncHornetQTaskClient("HumanTaskExample-testClient"));

                        taskClient.connect("127.0.0.1", 5445);

                        SystemEventListenerFactory.setSystemEventListener(new SystemEventListener());

                        //ingreso los parametros

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

                                    params.put("userId", "krisv");

                        params.put("description", "Yearly performance evaluation");

               //creo la instancia

               ksession.startProcess("com.sample.humantask", params);

               //cerrar las conexiones

                        try {

                                              taskClient.disconnect();

                                              taskHandler.dispose();

                                    } catch (Exception e) {

                                              // TODO Auto-generated catch block

                                              e.printStackTrace();

                                    }

                                    ksession.dispose();

                                    logger.close();

        }

      private static class SystemEventListener implements org.drools.SystemEventListener {

                               public void debug(String arg0) {

                               }

                               public void debug(String arg0, Object arg1) {

                               }

                               public void exception(Throwable arg0) {

                               }

                               public void exception(String arg0, Throwable arg1) {

                               }

                               public void info(String arg0) {

                               }

                               public void info(String arg0, Object arg1) {

                               }

                               public void warning(String arg0) {

                               }

                               public void warning(String arg0, Object arg1) {

                               }

                                    }

        • 1. Re: ProcessInstanceID not increment
          roxy1987

          Do you get exceptions? Please post if any.

          • 2. Re: ProcessInstanceID not increment
            betoflint

            Here is my exception.

             

            04/01 16:36:11,752[main] ERROR workitem.wsht.GenericHTWorkItemHandler.executeWorkItem  - Fri Jan 04 16:36:11 CLST 2013: Error when creating task on task server for work item id 1. Error reported by task server: Task operation request timed out

            java.lang.RuntimeException: Task operation request timed out

                      at org.jbpm.task.service.SyncTaskServiceWrapper.addTask(SyncTaskServiceWrapper.java:118)

                      at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler.executeWorkItem(GenericHTWorkItemHandler.java:145)

                      at org.drools.process.instance.impl.DefaultWorkItemManager.internalExecuteWorkItem(DefaultWorkItemManager.java:70)

                      at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:105)

                      at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:124)

                      at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:205)

                      at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:164)

                      at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:55)

                      at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:51)

                      at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:124)

                      at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:205)

                      at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:164)

                      at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)

                      at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)

                      at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:124)

                      at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35)

                      at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:188)

                      at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:303)

                      at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:168)

                      at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:138)

                      at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1082)

                      at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:320)

                      at cl.mop.ryc.bpm.bo.HumanTaskClient.execute(HumanTaskClient.java:49)

                      at cl.mop.ryc.bpm.bo.HumanTaskClient.main(HumanTaskClient.java:33)

            isConnected = true

            Exception in thread "main" java.lang.RuntimeException: Timeout : unable to retrieve results

                      at org.jbpm.task.service.responsehandlers.BlockingTaskSummaryResponseHandler.getResults(BlockingTaskSummaryResponseHandler.java:41)

                      at cl.mop.ryc.bpm.bo.HumanTaskClient.execute(HumanTaskClient.java:56)

                      at cl.mop.ryc.bpm.bo.HumanTaskClient.main(HumanTaskClient.java:33)

            • 3. Re: ProcessInstanceID not increment
              roxy1987

              Looks like your task service is not running.

              When you run the ant script start.demo, once the build is successful, just take a look at the directory \jbpm-installer\jboss-as-7.1.1.Final\standalone\deployments\.

               

              Once the .Deployed files for all the war files are generated, then try to run the example you have mentioned above. And see if the error still persists. Successful deployment of war file means that your task service has started. You dont need to explicitly start up human task service.

               

              After successful deployment, Your directory should look like this :

               

              Untitled.png

              The extension will keep changing before getting to .Deployed so wait for it to take its time. If for some reason, the extension changes to .Failed then you would need to figure out the reason for deployment failure.

               

              Saludos

              • 4. Re: ProcessInstanceID not increment
                roxy1987

                If everything is fine with respect to the task service then you can check the topic 

                https://community.jboss.org/thread/217472

                and try what is suggested there.

                I would suggest you to download jbpm 5.4.Final but it has nothing to do with the issue you are facing.