3 Replies Latest reply on Jun 7, 2011 6:38 PM by Chris Melas

    JBPM5 running processess/tasks behaviour when App Server shutdown/restart

    Anand Prakash Newbie

      My question is related to JBPM5 in case when we shutdown/restart app server(tomcat5) then what happens to running processes/task.

       

      1. Can we complete running processess/tasks when server restart ?Meaning will jbpm kick off old running processess/tasks and work as it is?

        If so then SessionInfo tables has one record related to last session then will it pick up that session ?

       

      2. If SessionInfo table need to maintain all records(sessions which were running before server down) then do we need to drop and create new hibernate_sequence when next time server starts which creates new session record with id "1" which is used in CommandDelegate to load knowledgesession as below-

       

      StatefulKnowledgeSession ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(1, kbase, config, env);

       

      We are creating new hibernate_sequence whenever server starts if hibernate_sequence doesn not exixts. So if it exists then SessionInfo table has record with id greater than 1 like 520,640 etc. ,So will this create issue in trigerring old processes/task which was running before server shutdown?

       

      I would appreciate if anybody has any idea or comments.

      Thanks,
      Anand

        • 1. Re: JBPM5 running processess/tasks behaviour when App Server shutdown/restart
          Burkhard Vogel Newbie

          Hi Anand,

          WRT 1) are you refering to a longer running task on your created process/flow that is interrupted due to a server outtake? in that case you can use the jbpm-console to trigger a continuation or restart of that process. outherwise you should be abe to access the next human task through the console just fine. If neither of these cases please elaborate what you are refering to.

          WRT 2) I don't understand. We have set the hibernate.hbm2ddl.auto property to "update" and just continue to use the sequence created on the first run - seems to be a DB issue - what DB are you on? If you use just one session  (1) you should be just fine and may reuse the session on the restart.

          • 2. Re: JBPM5 running processess/tasks behaviour when App Server shutdown/restart
            Anand Prakash Newbie

            Hi Brkhard,

            Thanks for your response. I'm not using jbpm console ,I've integrated jbpm with my application and from there I start processes/task.

             

            Yes I was talking about long running task meaning process/task which is started but not finished and if we restart server

            then will it pick trigger again with same old session in sessioninfo table with that id=1 ?  Mostly it works but sometime it doesn't complete the tasks after server restart may be because of old session is not used which had triggered those process/tasks.

            So new session gets created and that works fine to start new process/task.

             

            I'm using Oracle DB and on server(Tomcat) restart I test if JBPM sequence and tables is available then don't create new otherwise create new sequence/tables.

            Basically I need help related to session handling, I've notice some weird exception.Sometime after server restart I see "java.lang.NullPointerException" because ksession is null and hence while calling below line in CommandDelegate, application throw this exception.

            ksession.startProcess(processId, parameters).getId(); 

             

            While server start,app looks for sessioninfo table for default id "1" otherwise commanddelgate class creates new session but

            sometime I see below exception(error laoding session snapshot) and it never create or use old session to trigger old or new process/tasks.

            Loading process AutoCyclicalRiskAssesment.bpmn

            Loading session data ...

            Error loading session data: java.lang.reflect.InvocationTargetException

            Error loading session data: java.lang.RuntimeException: Unable to load session snapshot

            12:35:26,907 ERROR [CommandDelegate] java.lang.IllegalStateException: java.lang.reflect.InvocationTar

            getException

             

            This exception may be because "cause" is null throw exception but not sure why/how to tackle this session issue.

            So any help to handle session properly would be greatly appreciated .I need to know how to properly handle while server runs or if any server restart/shutdown/maintenance.

             

            Thanks,

            Anand

            • 3. Re: JBPM5 running processess/tasks behaviour when App Server shutdown/restart
              Chris Melas Apprentice

              Hello,

              Well i've noticed that when running a custom work item that takes long and the system goes down, then when the system restarts the tasks are not resumed thus not finished.

              What i do is since the custom work items are actually persisted in the database by the jbpm, when the system goes down before they've completed i've put some extra code to restart the work items present in the database as bootstrap code on the initialization of the system i.e.

              for (Object resultObject : results) {

              //where results are the rows from selecting the workitems from the database having name equal to my custom work items

                              WorkItemInfo workItemInfo = (WorkItemInfo) resultObject;

                              WorkItem workItem = workItemInfo.getWorkItem(ksession.getEnvironment());

                              MyCustomWorkItemHandler myCustomWorkItemHandler = new MyCustomWorkItemHandler ();

                              myCustomWorkItemHandler .executeWorkItem(workItem, ksession.getWorkItemManager());

                          }