8 Replies Latest reply on Nov 19, 2013 5:53 AM by Yogesh Gupta

    jbpm5 process instance persistence

    a_nat Newbie

      Hi forum,

       

      I have configured jbpm and human task to point to mysql db and started a few sample process, had them pending in a human task. Restarted the server to check whether pending process are persisted. Iam able to see the tasks in the tasks section, but not the processes.

       

      I herewith attach the peristence.xml, can someone point what am i missing and why am i not able to see the pending process instances after server restart?

       

      Regards,

      Aparna

        • 1. Re: jbpm5 process instance persistence
          Esteban Aliverti Master

          Did you try to complete the tasks?

          When the server starts up again, no processes are going to be running. As you mentioned, they are in a wait-state. So, if you want to continue with them execution, you will need to complete the corresponding user tasks.

          • 2. Re: jbpm5 process instance persistence
            a_nat Newbie

            When I try to complete the tasks, they get completed and they also complete the process instance, but my question is why aren't they being displyed in the process overview / execution history pages.

            The process is in a pending state and the process instance details are persisted in the db, but why aren't they displyed in the console?

             

            When pending tasks are being displayed after restart, why not pending process instances?

             

            Regards,

            Aparna

            • 3. Re: jbpm5 process instance persistence
              Janina Faggiano Newbie

              Instances of processes showing the console are on the table processInstanceLog, see if the table is empty when you reboot the server.

               

              In the original persistance.xml and persistance_human_task.xml the hibernate.hbm2ddl.auto property is create.

              When you restart the server processes the tables are created again, so do not time the process instance.

              The tasks related tables are created again when you run ant start.human.task.

              So if you restart the server and not restart the human task service the data are inconsistent.

               

              The link can help you

              http://community.jboss.org/message/589323 # 589323

               

               

               


              ,

              • 4. Re: jbpm5 process instance persistence
                a_nat Newbie

                Hi,

                 

                The table processInstancelog, doesn't get truncated after server restart, but i get the follwoing error during server restart...

                 

                2011-06-02 21:48:34,699 INFO  [org.hibernate.tool.hbm2ddl.SchemaValidator] (main) Running schema validator

                2011-06-02 21:48:34,700 INFO  [org.hibernate.tool.hbm2ddl.SchemaValidator] (main) fetching database metadata

                2011-06-02 21:48:34,759 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (main) table found: jbpm.eventtypes

                2011-06-02 21:48:34,760 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (main) columns: [element, instanceid]

                2011-06-02 21:48:34,786 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (main) table found: jbpm.nodeinstancelog

                2011-06-02 21:48:34,787 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (main) columns: [id, log_date, nodeinstanceid, type, processid, processinstanceid, nodeid]

                2011-06-02 21:48:34,798 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Start: name=persistence.unit:unitName=#org.jbpm.persistence.jpa state=Create

                javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory

                ...

                ...

                ...

                Caused by: org.hibernate.HibernateException: Missing column: nodeName in jbpm.nodeinstancelog

                at org.hibernate.mapping.Table.validateColumns(Table.java:277)

                at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1116)

                at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)

                at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:349)

                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)

                at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)

                at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

                ... 61 more

                 

                If i add the column manually to the table, it truncates the values in all the tables mentioned in the peristence.xml.

                If I don't add the column, iam uanble to view the processOverview / execution history pages. It thows the aforementioned error.

                 

                I'm using jbpm 5.1.0 against mysql 5.5.8 (using ApacheFriends XAMPP (Basispaket) version 1.7.4)

                 

                All of my persistence.xml is configured like this --- <property name="hibernate.hbm2ddl.auto" value="validate" />

                 

                Am i missing anything / do you smell anything wrong?

                 

                Thanks & Regards,

                Aparna

                • 5. Re: jbpm5 process instance persistence
                  a_nat Newbie

                  Hi all,

                   

                  I was able to crack this process instance persistence issue, got past the above error by making modifications to the  AuditLog.hbm.xml file (attached along), hiberante-cfg.xml and persistence.xml.

                   

                  I had to ensure that these files are present in all the jars in the following location:

                   

                  • jbpm-installer\runtime\jbpm-bam-5.1.0.M1.jar -- AuditLog.hbm.xml &  hibernate.cfg.xml
                  • jbpm-installer\runtime\jbpm-human-task-5.1.0.M1.jar -- persistence.xml
                  • jbpm-installer\jboss-5.1.0.GA\server\default\deploy\jbpm-gwt-console-server.war\web-inf\classes\META-INF  --- hibernate.cfg.xml & Persistence.xml
                    • Note : - jbpm-installer\jboss-5.1.0.GA\server\default\deploy\jbpm-gwt-console-server.war\web-inf\classes\hibernate.cfg.xml  comes from ant install.demo, if at all you have a proper file in jbpm-installer\db folder it would ensure its presence here
                  • jbpm-installer\jboss-5.1.0.GA\server\default\deploy\jbpm-gwt-console-server.war\web-inf\lib\jbpm-bam-5.1.0.M1.jar -- AuditLog.hbm.xml &  hibernate.cfg.xml
                  • jbpm-installer\jboss-5.1.0.GA\server\default\deploy\jbpm-gwt-console-server.war\web-inf\lib\jbpm-bam-5.1.0.M1.jar\META-INF -- persistence.xml

                   

                  Now, iam able to see both process instance and as well the pending tasks even after a server and task service restart.

                   

                  I also had to include the cloumn named "nodeName" in the nodeInstanceLog table as i had all my hiberante to validate the db, rather than create, but hope this hould bot be a concern.

                   

                  Kris,

                  If we could ensure that demo build process(ant install.demo does it in a few places, but not all and there is no means to modify the AuditLog.hbm.xml without going inside the jars)  includes this in all of the jars, it would be helpful for configuration.

                   

                  Regards,

                  Aparna

                  • 6. Re: jbpm5 process instance persistence
                    a_nat Newbie

                    Hi all,

                     

                    Just updating my post to share my findings on how these wrt jbpm5.1.0.

                     

                    I used the same  AuditLog.hbm.xml, hibernate-cfg.xml and persistence.xml as attached in my post before, but only had to the following 2 steps apart from placing them in jbpm-installer\db and doing the ant install.demo.

                    • jbpm-installer\runtime\jbpm-bam-5.1.0.M1.jar -- AuditLog.hbm.xml &  hibernate.cfg.xml
                    • jbpm-installer\runtime\jbpm-human-task-5.1.0.M1.jar -- persistence.xml

                     

                    With these I was able to see the task instances even after the restart of the server.

                     

                    Regards,

                    Aparna

                    • 7. Re: jbpm5 process instance persistence
                      Sandeep Sapra Newbie

                      Hi Aparna,

                       

                      I have almost same scenario.

                      I understand that the configurations you have told is to hold the data for tasks of a process into the database.

                       

                      Could you please let me know, what is the way out to retrieve those history data and show on the application view?

                      I mean to say any APIs available in jBPM (5.x) to retreive the information.

                       

                      Thanks and Regards,

                      Sandeep Sapra

                      • 8. Re: jbpm5 process instance persistence
                        Yogesh Gupta Newbie

                        Hi Aparna,
                        Have you created your own mechanism for workflow monitoring??
                        If yes than please guide me as well.

                         

                         

                        Thanks in advance

                         

                        Regards

                        Yogesh