9 Replies Latest reply on Jan 11, 2013 7:37 AM by Gareth Edwards

    Process Session ID always 0 in database

    Gareth Edwards Newbie

      Hello,

       

      I am starting a jbpm process using the following code:

       

       

                          KnowledgeBase kbase = readKnowledgeBase(); 

                          StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

       

       

                          AsyncHornetQHTWorkItemHandler workItemHandler = new AsyncHornetQHTWorkItemHandler(ksession);

       

                          workItemHandler.setIpAddress("10.0.0.101");

       

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

       

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

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

       

                          ksession.startProcess("defaultPackage.YesNo",params);

       

       

      The first time through the process works fine.

      Running the process again seems to log the results from the previous run through and throws an exception.

       

      8    03/01 16:13:41,694[Thread-1] ERROR service.hornetq.HornetQTaskClientConnector.run  - Client Exception with class class org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1 using port 5153

      java.lang.ClassCastException: org.jbpm.process.workitem.wsht.AsyncGenericHTWorkItemHandler$TaskAddedHandler cannot be cast to org.jbpm.task.service.TaskClientHandler$GetTaskResponseHandler

                at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:75)

                at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56)

                at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122)

                at java.lang.Thread.run(Thread.java:722)

      Verified

      Verified:true

       

      If I drop the jbpm5 schema and recreate it then it works fine again.

      From looking in the task table I see that the processsessionid is always 0.

      I'm using postgres as my database but I don't think that is the problem.

       

      I am creating the session on a different machine to the server that is running jBoss for development purposes if that makes a difference.

       

      Thinking about it, Surely I need to request a session from the server somehow as how will it know anything about other session ids in the database?