3 Replies Latest reply on May 19, 2010 7:48 AM by hbender

    Starting a BusinessProcess out of a PageFlow

    hbender

      Hi

       

      I have a pageflow definition, working, no problem. But one event within one page/view (in fact a timeout event) should lead to a new persisted business process instance, because now a person with another role must look at this issue. The original pageflow, if it follows the happy world path, does not need to be a persisted business process, it's just a ordinary pageflow: started, executed and terminated by one employee within one conversation.

       

      I can of course start the new business process within an action handler of the corresponding transition and then end the pageflow normally. But I want to show the transition to the new business process also in the visual pageflow picture, with an own node.

      I tried to use the ProcessState node of the page flow workbench:

       

      <process-state name="UnlockTokenProcess">
              <sub-process name="pdUnlockToken"></sub-process>
                    <action expression="#{scNextPukRetrieval.startUnlockProcess}" />
              <transition to="endPage" name="businessProcessCreated">
              </transition>
          </process-state>

       

      But at runtime, the Jbpm.class looks for another pageflow with the name pdUnlockToken and does not find one, although there is a business process definition with this name in the DB. How can I achieve that the jBPM framework can find business processes out from a page flow node??

       

      Thanks

      Heri

        • 1. Re: Starting a BusinessProcess out of a PageFlow
          aguizar

          Heri, can you put together a small app that allows me to reproduce this problem?

          • 2. Re: Starting a BusinessProcess out of a PageFlow
            hbender

            Hi Alejandro

             

            Thanks that you want to have a closer look.

             

            Attached an archive of a project which shows the problem (remark: it was a bit too big. I removed the lib jars from todoList/WebContent/WEB-INF/lib. I assume, you can add them manually again)

             

            It is a seam generated ear project, in fact the todoList-Demo of seam 2.2. jBPM is version 3.2.5, the Project was maintained in JBossDevStudio 3.0.

             


            The problem arises when deploying:

             


            12:24:05.223 (3853197) ERROR [HDScanner] org.jbpm.jpdl.xml.JpdlXmlReader - couldn't parse process definition
            java.lang.NullPointerException
                at org.jbpm.graph.node.DbSubProcessResolver.findSubProcess(DbSubProcessResolver.java:43)
                at org.jboss.seam.bpm.Jbpm$SeamSubProcessResolver.findSubProcess(Jbpm.java:374)
                at org.jbpm.graph.node.ProcessState.read(ProcessState.java:90)
                at org.jbpm.jpdl.xml.JpdlXmlReader.readNodes(JpdlXmlReader.java:261)
                at org.jboss.seam.bpm.PageflowParser.readNodes(PageflowParser.java:41)
                at org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:157)
                at org.jboss.seam.bpm.Jbpm.parseInputSource(Jbpm.java:359)
                at org.jboss.seam.bpm.Jbpm.getPageflowDefinitionFromResource(Jbpm.java:165)
                at org.jboss.seam.bpm.Jbpm.installPageflowDefinitions(Jbpm.java:278)

             

                at org.jboss.seam.bpm.Jbpm.startup(Jbpm.java:81)

             

            ...
                     
            When stepping through the code I can see that the DbSubProcessResolver.findSubProcess() method does not get a GraphSession (line 43), because I forgot to include the
                <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
            line in jbpm.cfg.xml. Astonishing, because before the ProcessDefinition was entered successfully into DB

             

            After I have added this line, the error occurs already before above code is executed:

             

            ERROR [main   ] org.jbpm.persistence.db.DbPersistenceService - hibernate commit failed
            org.hibernate.TransactionException: Transaction not successfully started                                   
                at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:134)                        
                at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:266)              
                at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:222) 
            ....                                                                                    

             


            Analyzing the log shows that now different persistence handlers are involved:

             


            Log-Output (without having declared persistence-service -> Error is no GraphSession):
            --------------------------------------------------------------------------------------

             

            INFO  [HDScanner] org.jboss.logging.Logger.info(Logger.java:296) - JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
            DEBUG [HDScanner] org.jbpm.persistence.jta.JtaDbPersistenceService.beginUserTransaction(JtaDbPersistenceService.java:74) - begin user transaction
            DEBUG [HDScanner] org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:104) - using current hibernate session
            INFO  [HDScanner] org.jboss.logging.util.LoggerStream.write(LoggerStream.java:156) - Hibernate: select processdef0_.ID_ as ID1_224_, processdef0_.NAME_ as NAME3_224_, processdef0_.DESCRIPTION_ as DESCRIPT4_224_, processdef0_.VERSION_ as VERSION5_224_, processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN6_224_, processdef0_.STARTSTATE_ as STARTSTATE7_224_ from JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by processdef0_.VERSION_ desc limit ?
            INFO  [HDScanner] org.jboss.logging.util.LoggerStream.write(LoggerStream.java:156) - Hibernate: insert into JBPM_PROCESSDEFINITION (NAME_, DESCRIPTION_, VERSION_, ISTERMINATIONIMPLICIT_, STARTSTATE_, CLASS_) values (?, ?, ?, ?, ?, 'P')
              ...
            INFO  [HDScanner] org.jboss.logging.util.LoggerStream.write(LoggerStream.java:156) - Hibernate: insert into JBPM_MODULEDEFINITION (NAME_, PROCESSDEFINITION_, STARTTASK_, CLASS_) values (?, ?, ?, 'T')
            DEBUG [HDScanner] org.jbpm.JbpmContext.close(JbpmContext.java:125) - closing jbpmContext org.jbpm.JbpmContext@5de3bd
            DEBUG [HDScanner] org.jbpm.persistence.jta.JtaDbPersistenceService.endUserTransaction(JtaDbPersistenceService.java:92) - committing user transaction
            INFO  [HDScanner] org.jboss.logging.util.LoggerStream.write(LoggerStream.java:156) - Hibernate: update JBPM_PROCESSDEFINITION set NAME_=?, DESCRIPTION_=?, VERSION_=?, ISTERMINATIONIMPLICIT_=?, STARTSTATE_=? where ID_=?
            ...
            INFO  [HDScanner] org.jboss.logging.util.LoggerStream.write(LoggerStream.java:156) - Hibernate: update JBPM_TRANSITION set TO_=? where ID_=?
            DEBUG [HDScanner] org.jbpm.configuration.JbpmContextInfo.createObject(JbpmContextInfo.java:145) - creating jbpm context with service factories '[]'
            DEBUG [HDScanner] org.jbpm.JbpmContext.<init>(JbpmContext.java:115) - creating org.jbpm.JbpmContext@1499884
            DEBUG [HDScanner] org.jbpm.configuration.JbpmContextInfo.createObject(JbpmContextInfo.java:145) - creating jbpm context with service factories '[]'
            DEBUG [HDScanner] org.jbpm.JbpmContext.<init>(JbpmContext.java:115) - creating org.jbpm.JbpmContext@9fa838
            ERROR [HDScanner] org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:168) - couldn't parse process definition
            org.dom4j.DocumentException: Read error Nested exception: Read error
                at org.dom4j.io.SAXReader.read(SAXReader.java:484)
                at org.jbpm.jpdl.xml.JpdlParser.parse(JpdlParser.java:66)
                at org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:142)
                at org.jboss.seam.bpm.Jbpm.parseInputSource(Jbpm.java:359)
            ...

             


            Log-Output (without having declared persistence-service -> error arise somewhere in the persistence handlers):
            -------------------------------------------------------------------------------------------------------------
               
            DEBUG [main   ] org.jbpm.persistence.db.DbPersistenceService - creating hibernate session
            DEBUG [main   ] org.jbpm.persistence.db.DbPersistenceService - beginning hibernate transaction
            DEBUG [main   ] org.jbpm.persistence.db.DbPersistenceService - begun hibernate transaction org.hibernate.transaction.JTATransaction@8422f0
            INFO  [main   ] STDOUT - Hibernate: select processdef0_.ID_ as ID1_0_, processdef0_.NAME_ as NAME3_0_, processdef0_.DESCRIPTION_ as DESCRIPT4_0_, processdef0_.VERSION_ as VERSION5_0_, processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN6_0_, processdef0_.STARTSTATE_ as STARTSTATE7_0_ from JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by processdef0_.VERSION_ desc limit ?
            ...
            INFO  [main   ] STDOUT - Hibernate: insert into JBPM_MODULEDEFINITION (NAME_, PROCESSDEFINITION_, STARTTASK_, CLASS_) values (?, ?, ?, 'T')
            DEBUG [main   ] org.jbpm.JbpmContext - closing jbpmContext org.jbpm.JbpmContext@13f557
            DEBUG [main   ] org.jbpm.persistence.db.DbPersistenceService - committing org.hibernate.transaction.JTATransaction@8422f0
            INFO  [main   ] STDOUT - Hibernate: update JBPM_PROCESSDEFINITION set NAME_=?, DESCRIPTION_=?, VERSION_=?, ISTERMINATIONIMPLICIT_=?, STARTSTATE_=? where ID_=?
            ...
            INFO  [main   ] STDOUT - Hibernate: update JBPM_TRANSITION set TO_=? where ID_=?
            DEBUG [main   ] org.jbpm.persistence.db.DbPersistenceService - closing hibernate session
            DEBUG [main   ] org.jbpm.persistence.db.DbPersistenceService - committing org.hibernate.transaction.JTATransaction@8422f0
            ERROR [main   ] org.jbpm.persistence.db.DbPersistenceService - hibernate commit failed
            org.hibernate.TransactionException: Transaction not successfully started
                at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:134)
                at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:266)
                at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:222)
                at org.jbpm.svc.Services.close(Services.java:294)
                at org.jbpm.JbpmContext.close(JbpmContext.java:136)
                at org.jboss.seam.bpm.Jbpm.installProcessDefinitions(Jbpm.java:304)
                at org.jboss.seam.bpm.Jbpm.startup(Jbpm.java:80)

            • 3. Re: Starting a BusinessProcess out of a PageFlow
              hbender

              Sorry, the previous archive missed some files. Find attached a new archive (again the jars from lib stripped off).

              Heri