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

    ProcessInstanceId always is 1

    betoflint

      Hi, i have a jboss server 7.0.2 with jbpm 5.3 and oracle 11g, the persistence work fine after two month of configuration and distinct test.

      Now, i have a problem when i run my app on my web application, if i run my .bpmn (evaluation) on my console work all fine, the tables has data and id's works fine, the distinct process instance have an particular id. Here, all perfect, but i want now run the same .bpmn with de  api of jbpm from my project, but appear an error telling me the next: 

      My question is how i can reserv an id for my instance in api. I must change something from my code???

      Thanks and i hope that somebody can help me!!

      Sorry for the english!!

       

      CODE:

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

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

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

                          KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

                          kbuilder.add(ResourceFactory.newClassPathResource("Evaluation.bpmn"), ResourceType.BPMN2);

                          KnowledgeBase kbase = kbuilder.newKnowledgeBase();

                          StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

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

              hornetQHTWorkItemHandler = new HornetQHTWorkItemHandler(ksession);

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

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

              taskClient.connect("127.0.0.1", 5445);

              SystemEventListenerFactory.setSystemEventListener(new SystemEventListener());

              org.drools.runtime.process.ProcessInstance piId = ksession.createProcessInstance("com.sample.evaluation", params);

                          ksession.startProcessInstance(piId.getId());

       

       

       

      ERROR LOG:

      1    03/01 16:44:39,184[main] ERROR workitem.wsht.GenericHTWorkItemHandler.executeWorkItem  - Thu Jan 03 16:44:39 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.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.drools.common.AbstractWorkingMemory.startProcessInstance(AbstractWorkingMemory.java:1092)

                at org.drools.impl.StatefulKnowledgeSessionImpl.startProcessInstance(StatefulKnowledgeSessionImpl.java:330)

                at com.sample.testa.main(testa.java:48)

        • 1. Re: ProcessInstanceId always is 1
          roxy1987

          Your task service should be up and running before you execute this code.

          May the problem is with the connection. Try using localhost instead of 127.0.0.1 or may be verify the port with the default port set in the war file.

          • 2. Re: ProcessInstanceId always is 1
            betoflint

            Yes the task services is running ok...when i run the server in the log appear that hornetq task services is running and without problems.

            You say about a war file...in which??

            • 3. Re: ProcessInstanceId always is 1
              roxy1987

              jbpm-gwt-console-server.war\WEB-INF\classes\default.jbpm.console.properties

               

              look for jbpm.console.task.service.port value. In jbpm 5.4 it is set as 5153 and not 5445. Not sure about jbpm 5.3.

              • 4. Re: ProcessInstanceId always is 1
                betoflint

                mmm thanks, but the war is deploy correctly. The problem that i have, is that, when i want create a new instance from my code, always generate processinstanceid = 1 in my database...the task its save, but always with id 1, my question is at code level.

                How i can run for example a process two times, and in the firs time the processinstanceid = 1 and in the second time the processinstanceid = 2.

                really i´m lost with the handler use of the human task service.

                thanks! and im sorry for the english...

                • 5. Re: ProcessInstanceId always is 1
                  roxy1987

                  It doesnt generate the same id again and again. The error stack trace says that the human task server is not running. So may be you wanna do a clean install of jbpm and try this thing again, considering ofcourse that you have verified that the task service is running. My recommendation, use jbpm 5.4 final version instead of installing 5.3 again.