1 Reply Latest reply on Nov 7, 2012 2:28 PM by Jonathan Albornoz

    jbpm 5.3 not complete the task

    Jonathan Albornoz Newbie

      hi! i have a problem and i want to know if any of you can tell me what to do!

      thanks!

       

      Enviroment:

      -Windows 7 x64

      -jBPM 5.3 Final Release

      -Jboss 7.1.1

      -H2 Database

      -Web application in java

      -Jdk  1.6

       

      The application is about the insert of many request of the people…this activate a workflow….just instance when the request is inserted…

      Then a person associated with a group has the responsibility to accept the request that in the workflow means that the process is started…then completed…

      The problem is that when I insterted an instance of a process… (ksession.startProcess("com.sample.humantask", params) this is saved in h2 in the task table and then I close the connection…when I want complete this task…i make the connection again…complete my task…but don’t start automaticly the next node of my process…I imagine that this happen because I put ksession.dispose after the instance of my process….

      How I can save my ksession and the use it to my propose….i will put the code that I use…and sorry for my English…is not native! Thanks…..

       

      This is part of the method that I use to instance my process….

       

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

                         Proceso procMotorWF = new Proceso(); 

                         procMotorWF.crearConexion();//create the connection

                        

              parametros = procMotorWF.definirSolicitud(usuario_solicitud);

              procMotorWF.instanciarProceso(parametros);

      List<String> grupo = new ArrayList<String>();

      grupo.add("sales");

      List<TaskSummary> listaTareas = procMotorWF.obtenerPosibles(usuario, grupo);

                         Object object = listaTareas.get(listaTareas.size()-1);

                         TaskSummary ultimaInstancia = (TaskSummary)object;

                         Integer idProceso = new Integer((int)ultimaInstancia.getId()); 

                         //System.out.println("La ultima instancia generada contiene el id"+ultimaInstancia.getId());

                                           

                         procMotorWF.cerrarConexion();

                  

       

      There is the open and close connection

       

      public void crearConexion(){ //open connection

                         if (kbase == null){

                                  try {

                                            kbase = readKnowledgeBase();

                                  } catch (Exception e) {

                                            // TODO Auto-generated catch block

                                            e.printStackTrace();

                                  }

                         }

                         if (ksession==null){

                                  ksession = kbase.newStatefulKnowledgeSession();

                         }

                         if (logger==null && ksession!=null){

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

                         }

                         if(hornetQHTWorkItemHandler==null && ksession!=null){

                                  hornetQHTWorkItemHandler = new HornetQHTWorkItemHandler(ksession);        

                         }

                         if(ksession!=null){

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

                         }

                         if(taskClient==null){

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

                                  taskClient.connect("127.0.0.1", 5445);

                       SystemEventListenerFactory.setSystemEventListener(new SystemEventListener());

                         }

                        

               }

                        

               public void cerrarConexion(){ //close connection

                         try {

                                  taskClient.disconnect();

                                 

                                            hornetQHTWorkItemHandler.dispose();

                                  } catch (Exception e) {

                                            // TODO Auto-generated catch block

                                            e.printStackTrace();

                                  }

                         ksession.dispose();

                        

                         logger.close();

                         taskClient = null;

                         hornetQHTWorkItemHandler = null;

                         ksession=null;

                         logger = null;

                        

               }

       

               Any idea what i have to do in this case…????

               Very thanks to all of you!! Nad again sorry for my English….

      If you need mor information…just tell me!