11 Replies Latest reply on Dec 18, 2007 9:26 AM by Albrecht Olivier

    Timer Task never fired

    Albrecht Olivier Newbie

      Hello,

      I try to add a timer to a task-node like this :

      <task-node name="Prise En Charge">
       <timer name="timer-AlerteDeclenchee" duedate="1 second" repeat="2 seconds" >
       <action name="Renotification" class="ocd.common.workflow.process.action.NotificationTimerHandler"></action>
       </timer>
      


      I have setted up my jbpm.cfg.xml with a scheduler like this :

      <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
      


      Everything starts corretly, I can see the logs what shows that my timer is started on create-node event :

      10:52:23,770 DEBUG GraphElement:170 - event 'timer-create' on 'TaskNode(Prise En Charge)' for 'Token(/)'
      


      and the timer is deleted when the node-leave event is thrown
      10:58:47,676 DEBUG SQL:401 - select timer0_.ID_ as ID1_26_, timer0_.VERSION_ as VERSION3_26_, timer0_.DUEDATE_ as DUEDATE4_26_, timer0_.PROCESSINSTANCE_ as PROCESSI5_26_, timer0_.TOKEN_ as TOKEN6_26_, timer0_.TASKINSTANCE_ as TASKINST7_26_, timer0_.ISSUSPENDED_ as ISSUSPEN8_26_, timer0_.ISEXCLUSIVE_ as ISEXCLUS9_26_, timer0_.LOCKOWNER_ as LOCKOWNER10_26_, timer0_.LOCKTIME_ as LOCKTIME11_26_, timer0_.EXCEPTION_ as EXCEPTION12_26_, timer0_.RETRIES_ as RETRIES13_26_, timer0_.NAME_ as NAME14_26_, timer0_.REPEAT_ as REPEAT15_26_, timer0_.TRANSITIONNAME_ as TRANSIT16_26_, timer0_.ACTION_ as ACTION17_26_, timer0_.GRAPHELEMENTTYPE_ as GRAPHEL18_26_, timer0_.GRAPHELEMENT_ as GRAPHEL19_26_ from JBPM_JOB timer0_ where timer0_.CLASS_='T' and timer0_.TOKEN_=? and timer0_.NAME_=?
      10:58:47,676 DEBUG JobSession:171 - deleting timer timer(timer-AlerteDeclenchee,10:58:21,066) by name timer-AlerteDeclenchee
      


      I have tried to add a Thread.sleep(20000) to see if the timeout is fired but nothing seems to come ...

      Any advice should be great !



        • 1. Re: Timer Task never fired
          Ronald van Kuijk Master

          do you have a task in the tasknode? You should otherwise it will go straightly through.

          • 2. Re: Timer Task never fired
            Albrecht Olivier Newbie

            Yes there is a task. I have tried to set the timer on my task :

            <task-node name="Prise En Charge">
             <task name="Prendre en charge">
             <timer name="timer-AlerteDeclenchee" duedate="2 seconds" repeat="true" >
             <action name="Renotification" class="ocd.common.workflow.process.action.NotificationTimerHandler"></action>
             </timer>
             <assignment class="ocd.common.workflow.process.action.AssignerUtilisateur"></assignment>
             <controller>
             <variable name="acteurID" access="read,write,required"></variable>
             <variable name="txtMessage" access="read,write,required"></variable>
             <variable name="listeDeDiffusion" access="read,write,required"></variable>
             </controller>
             </task>
             <event type="node-enter">
             <action name="Notification (Alerte declenchee)" class="ocd.common.workflow.process.action.NotificationTimerHandler" config-type="bean">
             </action>
             </event>
             <event type="node-leave">
             <action name="Notification (Alerte prise en charge)" class="ocd.common.workflow.process.action.NotificationHandler"></action>
             </event>
             <transition name="Alerte prise en charge" to="Decision Crise">
             </transition>
             </task-node>
            


            Then I have the create timer on my logs :
            13:43:03,505 DEBUG GraphElement:247 - executing action 'CreateTimerAction(1a82e92)'
            13:43:03,505 DEBUG Token:648 - token[5654] is locked by token[5654]
            13:43:03,505 DEBUG GraphElement:170 - event 'timer-create' on 'Task(Prendre en charge)' for 'Token(/)'
            


            but I do not have a delete timer (Perhaps because on my Junit Test, I do not have a task.end() I just use the context.signal () to jump on the other node )

            In conclusion, I steel do not have any fired timer ...
            My action timer is never use and I do not have any log of this event ...

            Is there something else to set configuration on because I do not use JBoss. For the moment only Junit and Spring, and after Tomcat will be my Web Application Server... ?

            Thanks for your help

            • 3. Re: Timer Task never fired
              Ronald van Kuijk Master

              do you have a jobscheduler running?

              • 4. Re: Timer Task never fired
                Albrecht Olivier Newbie


                I put my timer back on my task-node.

                I have a DBScheduler defined in my jbpm.cfg.xml

                I didn't have any jobscheduler, i just had this on my jbpm.cfg.xml :

                
                 <bean name="jbpm.job.executor"
                 class="org.jbpm.job.executor.JobExecutor">
                 <field name="jbpmConfiguration">
                 <ref bean="jbpmConfiguration" />
                 </field>
                 <field name="name">
                 <string value="JbpmJobExector" />
                 </field>
                 <field name="nbrOfThreads">
                 <int value="1" />
                 </field>
                 <field name="idleInterval">
                 <int value="1000" />
                 </field>
                 <field name="maxIdleInterval">
                 <int value="10000" />
                 </field>
                 </bean>
                
                


                But doesn't work ... It is a job, but do I have to start it programmaticaly ? How do I do this ... and when do I have to start it, at the beginging of my process instance ?

                • 5. JobExecutor exception
                  Albrecht Olivier Newbie

                  Hello,

                  I am would like to use a timer with JBPM 3.2.1. and Spring framework
                  I found the way with a JobExecutor :

                  in JBPM.cfg.xml I put the JobExecutor configuration like this :

                   <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
                   <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
                   <field name="name"><string value="JbpmJobExecutor" /></field>
                   <field name="nbrOfThreads"><int value="1" /></field>
                   <field name="idleInterval"><int value="5000" /></field>
                   <field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
                   <field name="historyMaxSize"><int value="20" /></field>
                   <field name="maxLockTime"><int value="20000" /></field> <!-- 20 sec -->
                   <field name="lockMonitorInterval"><int value="10000" /></field> <!-- 10 sec -->
                   <field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->
                   </bean>
                  


                  And I put my JobExecutorServlet on the web.xml :



                  <servlet>
                   <servlet-name>JobExecutorServlet</servlet-name>
                   <servlet-class>org.jbpm.job.executor.JobExecutorServlet</servlet-class>
                   <load-on-startup>1</load-on-startup>
                  </servlet>
                  
                  <servlet-mapping>
                   <servlet-name>JobExecutorServlet</servlet-name>
                   <url-pattern>/jobs</url-pattern>
                  </servlet-mapping>
                  


                  When I start my web application with this new Servlet I get an error but I can't see the relationship between my JobExecutor and the error.

                  The Job seems to start correctly :
                  14:30:43,689 DEBUG ObjectFactoryImpl:59 - adding object info 'jbpm.job.executor'
                  14:30:43,689 DEBUG ObjectFactoryImpl:59 - adding object info 'jbpmConfiguration'
                  14:30:43,705 DEBUG JobExecutor:41 - starting thread group 'JbpmJobExector'...
                  14:30:43,736 DEBUG JobExecutor:87 - starting new job executor thread 'JbpmJobExector:10.138.101.47:1'
                  


                  When It try to close the JBPMContext It throws an exception about JBPM_NODE table ...

                  14:31:34,691 DEBUG JbpmContext:133 - closing JbpmContext
                  14:31:34,691 DEBUG Services:221 - closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@19ee8a
                  14:31:36,878 ERROR JobExecutorThread:83 - exception in job executor thread. waiting 5000 milliseconds
                  org.hibernate.MappingException: An association from the table JBPM_NODE refers to an unmapped class: org.jbpm.graph.action.Script
                   at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1249)
                   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1167)
                   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1283)
                   at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
                   at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:107)
                   at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:111)
                   at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:401)
                   at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:563)
                   at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:110)
                   at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:56)
                  


                  Can somebody explain me why ? and how to correct this problem ? It seems to be a configuration problem but I don't know what to change ...

                  Thanks for your help

                  • 6. Re: Timer Task never fired
                    Ronald van Kuijk Master

                    uncomment the reference to the script hbm file in the hibernate config

                    • 7. Re: Timer Task never fired
                      Albrecht Olivier Newbie


                      It's already un-commented :

                       <!-- following mapping file has a dependendy on -->
                       <!-- 'bsh-{version}.jar'. -->
                       <!-- uncomment this if you don't have bsh on your -->
                       <!-- classpath. you won't be able to use the -->
                       <!-- script element in process definition files -->
                       <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
                      


                      Is it possible that my JobExecutor doesn't find my hibernate.cfg.xml file in spite of my process is correctly instanciated ?

                      Everything works find ... except this JobExecutor and my timer.

                      Can somebody explain me how the timer, the DbSchedulerServiceFactory and the JobExecutor work together because I don't understand the User Guide explication and I don't see the JobExecutor... (http://docs.jboss.com/jbpm/v3.2/userguide/html/scheduler.html#timers)?
                      [/url]

                      • 8. Re: Timer Task never fired
                        Albrecht Olivier Newbie

                        I am steel in a dead end...

                        I have my jbpm 3.2 , my jbpm.job.executor and my DbSchedulerServiceFactory defined on mya jbpm.cfg, my JobExecutorServlet defined on my web.xml and my timer on my task process but nothing seems to work ...

                        Does somebody have any idea ?

                        • 9. Re: Timer Task never fired
                          Albrecht Olivier Newbie

                          I found the solution....

                          I am using the spring_module for jbpm3.1. with jbpm3.2.1
                          The problem is in the LocalJbpmConfigurationFactoryBean of the module.
                          This class instanciate the jbpmConfiguration but the problem is that it uses only a

                          new JbpmConfiguration(ObjectFactory)
                          to instanciate my configuration.

                          This methode doesn't put this instanciation on the jbpmConfiguration's ObjectFactory.

                          The JobExecutor use this ObjectFactory to get the JbpmConfiguration ... Then if you don't modify this module sources it won't work ....

                          I changed this :



                          • 11. Re: Timer Task never fired
                            Albrecht Olivier Newbie

                            Used this code in the java class LocalJbpmConfigurationFactoryBean of the spring for jbpm module :

                            JbpmConfiguration.Configs.setDefaultObjectFactory(objectFactory);
                            jbpmConfiguration = JbpmConfiguration.getInstance();