12 Replies Latest reply on Nov 10, 2006 10:43 AM by Eugene

    Please help me,  'scheduler' unavailable ??

    Andres Gomez Newbie

      Hello
      This is the exception:

      11:30:53,781 ERROR GraphElement:242 - action threw exception: service 'scheduler' unavailable
      org.jbpm.svc.JbpmServiceException: service 'scheduler' unavailable

      What i need to configure?

      Thanks

        • 1. Re: Please help me,  'scheduler' unavailable ??
          Alejandro Guizar Master

          Make sure your jbpm.cfg.xml file declares a factory for the scheduler service:

          <jbpm-context>
           <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
           <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
           <!-- do I exist?? -->
           <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
           <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
           <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
           </jbpm-context>


          • 2. Re: Please help me,  'scheduler' unavailable ??
            Andres Gomez Newbie

            Hello, the problem was that the jbpmContext was closed before.
            But the problem was fixed.

            Thanks

            • 3. Re: Please help me,  'scheduler' unavailable ??
              rachid rachid Newbie

              hi afgomez

              can you give me other details about this, because i have the same problem.

              thank u in advance

              • 4. Re: Please help me,  'scheduler' unavailable ??
                Andres Gomez Newbie

                Hello,
                The problem that i had was fixed that:
                Each time that you need a transaction, you must use a block that:

                //Out of method
                private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration
                .parseResource("jbpm.cfg.xml");

                public void makeSomething(String strProcessName){
                JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
                try{
                processDefinition = JbpmContext.getCurrentJbpmContext()
                .getGraphSession().findLatestProcessDefinition(
                strProcessName);
                ...
                ...
                }catch(..){
                }finally {
                jbpmContext.close();
                }
                }

                • 5. Re: Please help me,  'scheduler' unavailable ??
                  Eugene Newbie

                  I am getting a similar error and cannot fix it the way suggested above.

                  I created a new Process Project in Eclipse (with JBoss jBPM plugin) and checked the option to "Generate simple process definition, action handler and JUnit test". It worked fine. Then I added a timer to the middle State:

                  <state name="first">
                   <timer duedate='30 seconds'>
                   <action name="action" class="com.sample.action.MessageActionHandler" />
                   </timer>
                   <transition name="to_end" to="end">
                   <action name="action" class="com.sample.action.MessageActionHandler">
                   <message>About to finish!</message>
                   </action>
                   </transition>
                   </state>
                  


                  Now I'm getting an error:
                  14:50:48,888 [main] DEBUG GraphElement : executing action 'CreateTimerAction(544ec1)'
                  14:50:48,888 [main] DEBUG GraphElement : event 'timer-create' on 'State(wait for completion event)' for 'Token(/)'
                  14:50:48,904 [main] ERROR GraphElement : action threw exception: service 'scheduler' unavailable
                  

                  and the stacktrace is:
                  org.jbpm.svc.JbpmServiceException: service 'scheduler' unavailable
                   at org.jbpm.svc.Services.getCurrentService(Services.java:86)
                   at org.jbpm.svc.Services.getCurrentService(Services.java:76)
                   at org.jbpm.scheduler.def.CreateTimerAction.execute(CreateTimerAction.java:66)
                   at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:235)
                   at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:212)
                   at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:182)
                   at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:166)
                   at org.jbpm.graph.def.Node.enter(Node.java:301)
                   at org.jbpm.graph.def.Transition.take(Transition.java:119)
                   at org.jbpm.graph.def.Node.leave(Node.java:383)
                   at org.jbpm.graph.node.StartState.leave(StartState.java:70)
                   at org.jbpm.graph.exe.Token.signal(Token.java:174)
                   at org.jbpm.graph.exe.Token.signal(Token.java:123)
                   at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:217)
                   at com.sample.SimpleProcessTest.testSimpleProcess(SimpleProcessTest.java:32)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at junit.framework.TestCase.runTest(TestCase.java:154)
                   at junit.framework.TestCase.runBare(TestCase.java:127)
                   at junit.framework.TestResult$1.protect(TestResult.java:106)
                   at junit.framework.TestResult.runProtected(TestResult.java:124)
                   at junit.framework.TestResult.run(TestResult.java:109)
                   at junit.framework.TestCase.run(TestCase.java:118)
                   at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
                   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
                  


                  • 6. Re: Please help me,  'scheduler' unavailable ??
                    Ronald van Kuijk Master

                    what jbpm version
                    what server is it running in
                    what is the config
                    etc
                    etc
                    etc

                    • 7. Re: Please help me,  'scheduler' unavailable ??
                      Eugene Newbie

                       

                      "kukeltje" wrote:
                      what jbpm version
                      what server is it running in
                      what is the config


                      This is 3.1.2. I am trying to run it as a JUnit test (stand-alone), which works fine until I add the timer. Without the timer, empty config with the default values works fine. With the timer, it does not. I have added the configuration below, but it did not help.

                      <jbpm-configuration>
                      
                       <jbpm-context>
                       <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
                       <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
                       <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
                       <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
                       <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
                       </jbpm-context>
                      
                       <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
                       <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
                       <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
                       <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
                       <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
                       <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
                       <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
                       <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
                      
                       <int name="jbpm.byte.block.size" value="1024" singleton="true" />
                       <bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" />
                       <bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
                       <long name="jbpm.msg.wait.timout" value="5000" singleton="true" />
                      
                      </jbpm-configuration>
                      


                      • 8. Re: Please help me,  'scheduler' unavailable ??
                        d b Newbie

                        have you created a scheduler and started it?

                        • 10. Re: Please help me,  'scheduler' unavailable ??
                          Eugene Newbie

                           

                          "cwad0000" wrote:
                          have you created a scheduler and started it?


                          I just realized that it was not running (in a separate JVM, as per docs) because it was throwing a null pointer exception. So, then I modified the source as explained in http://jira.jboss.com/jira/browse/JBPM-315?page=comments. Now I see:
                          13:45:11,943 [main] DEBUG Scheduler : starting the scheduler
                          13:45:11,959 [main] INFO JbpmConfiguration : using jbpm configuration resource 'jbpm.cfg.xml'
                          13:45:11,959 [main] DEBUG JbpmConfiguration : loading defaults in jbpm configuration
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'default.jbpm.context'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.hibernate.cfg.xml'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.business.calendar'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.default.modules'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.converter'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.action.types'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.node.types'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.parsers'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.varmapping'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.msg.wait.timout'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.byte.block.size'
                          13:45:12,381 [main] DEBUG ObjectFactoryImpl : adding object info 'mail.smtp.host'
                          13:45:12,396 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.task.instance.factory'
                          13:45:12,396 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.variable.resolver'
                          13:45:12,396 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.mail.address.resolver'
                          13:45:12,396 [main] DEBUG JbpmConfiguration : loading specific configuration...
                          13:45:12,412 [main] DEBUG ObjectFactoryImpl : adding object info 'default.jbpm.context'
                          13:45:12,412 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.business.calendar'
                          13:45:12,412 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.default.modules'
                          13:45:12,412 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.converter'
                          13:45:12,412 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.action.types'
                          13:45:12,412 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.node.types'
                          13:45:12,412 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.parsers'
                          13:45:12,412 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.varmapping'
                          13:45:12,427 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.byte.block.size'
                          13:45:12,427 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.task.instance.factory'
                          13:45:12,427 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.variable.resolver'
                          13:45:12,427 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.msg.wait.timout'
                          13:45:12,459 [JbpmScheduler] DEBUG JbpmContextInfo : creating jbpm context with service factories '[message, scheduler, logging, persistence, authentication]'
                          13:45:12,459 [JbpmScheduler] DEBUG JbpmContext : creating JbpmContext
                          13:45:12,459 [JbpmScheduler] DEBUG DbPersistenceServiceFactory : creating persistence service
                          13:45:12,459 [JbpmScheduler] DEBUG JbpmContext : closing JbpmContext
                          Exception in thread "JbpmScheduler" java.lang.NoClassDefFoundError: org/hibernate/Session
                           at org.jbpm.persistence.db.DbPersistenceServiceFactory.openService(DbPersistenceServiceFactory.java:55)
                           at org.jbpm.svc.Services.getService(Services.java:136)
                           at org.jbpm.svc.Services.getPersistenceService(Services.java:175)
                           at org.jbpm.JbpmContext.getPersistenceService(JbpmContext.java:594)
                           at org.jbpm.JbpmContext.getSchedulerSession(JbpmContext.java:527)
                           at org.jbpm.scheduler.impl.SchedulerThread.executeTimers(SchedulerThread.java:103)
                           at org.jbpm.scheduler.impl.SchedulerThread.run(SchedulerThread.java:70)



                          • 11. Re: Please help me,  'scheduler' unavailable ??
                            Ronald van Kuijk Master

                            I think, but the chance that I'm wrong is high, that there is no hibernate on the classpath. Just a guess, but you might give it a try if everything else fails

                            • 12. Re: Please help me,  'scheduler' unavailable ??
                              Eugene Newbie

                               

                              "kukeltje" wrote:
                              I think, but the chance that I'm wrong is high, that there is no hibernate on the classpath.


                              You are right! I was under the wrong impression that a default Process Project created with the jBPM plugin would contain all dependencies, but hibernate is not there. I added hibernate3.jar and now I see:

                              10:33:19,208 [main] DEBUG Scheduler : starting the scheduler
                              10:33:19,239 [main] INFO JbpmConfiguration : using jbpm configuration resource 'jbpm.cfg.xml'
                              10:33:19,239 [main] DEBUG JbpmConfiguration : loading defaults in jbpm configuration
                              
                              ...
                              
                              10:33:19,786 [JbpmScheduler] DEBUG JbpmContextInfo : creating jbpm context with service factories '[message, scheduler, logging, persistence, authentication]'
                              10:33:19,786 [JbpmScheduler] DEBUG JbpmContext : creating JbpmContext
                              10:33:19,786 [JbpmScheduler] DEBUG DbPersistenceServiceFactory : creating persistence service
                              10:33:19,786 [JbpmScheduler] DEBUG DbPersistenceServiceFactory : building hibernate session factory
                              10:33:19,833 [JbpmScheduler] INFO Environment : Hibernate 3.1
                              10:33:19,849 [JbpmScheduler] INFO Environment : hibernate.properties not found
                              10:33:19,849 [JbpmScheduler] INFO Environment : using CGLIB reflection optimizer
                              10:33:19,864 [JbpmScheduler] INFO Environment : using JDK 1.4 java.sql.Timestamp handling
                              10:33:19,958 [JbpmScheduler] DEBUG HibernateHelper : creating hibernate configuration resource 'hibernate.cfg.xml'
                              10:33:19,958 [JbpmScheduler] INFO Configuration : configuring from resource: hibernate.cfg.xml
                              10:33:19,958 [JbpmScheduler] INFO Configuration : Configuration resource: hibernate.cfg.xml
                              
                              ...
                              
                              10:33:23,114 [JbpmScheduler] INFO DriverManagerConnectionProvider : Using Hibernate built-in connection pool (not for production use!)
                              10:33:23,114 [JbpmScheduler] INFO DriverManagerConnectionProvider : Hibernate connection pool size: 20
                              10:33:23,114 [JbpmScheduler] INFO DriverManagerConnectionProvider : autocommit mode: false
                              10:33:23,114 [JbpmScheduler] INFO DriverManagerConnectionProvider : using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:mem:.;sql.enforce_strict_size=true
                              10:33:23,114 [JbpmScheduler] INFO DriverManagerConnectionProvider : connection properties: {user=sa, password=****}
                              10:33:23,474 [JbpmScheduler] INFO SettingsFactory : RDBMS: HSQL Database Engine, version: 1.8.0
                              10:33:23,474 [JbpmScheduler] INFO SettingsFactory : JDBC driver: HSQL Database Engine Driver, version: 1.8.0
                              10:33:23,489 [JbpmScheduler] INFO Dialect : Using dialect: org.hibernate.dialect.HSQLDialect
                              10:33:23,505 [JbpmScheduler] INFO TransactionFactoryFactory : Using default transaction strategy (direct JDBC transactions)
                              10:33:23,505 [JbpmScheduler] INFO TransactionManagerLookupFactory : No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
                              
                              ...
                              
                              10:33:26,145 [JbpmScheduler] INFO SessionFactoryObjectFactory : Not binding factory to JNDI, no JNDI name configured
                              10:33:26,145 [JbpmScheduler] INFO SessionFactoryImpl : Checking 28 named HQL queries
                              10:33:26,614 [JbpmScheduler] INFO SessionFactoryImpl : Checking 0 named SQL queries
                              10:33:26,614 [JbpmScheduler] DEBUG DbPersistenceService : creating hibernate session
                              10:33:26,677 [JbpmScheduler] DEBUG DbPersistenceService : beginning hibernate transaction
                              10:33:26,692 [JbpmScheduler] DEBUG SchedulerThread : checking for timers
                              10:33:26,724 [JbpmScheduler] WARN JDBCExceptionReporter : SQL Error: -22, SQLState: S0002
                              10:33:26,724 [JbpmScheduler] ERROR JDBCExceptionReporter : Table not found in statement [select timer0_.ID_ as col_0_0_ from JBPM_TIMER timer0_ where (timer0_.EXCEPTION_ is null) and timer0_.ISSUSPENDED_<>1 order by timer0_.DUEDATE_ asc]
                              10:33:26,724 [JbpmScheduler] ERROR SchedulerSession : org.hibernate.exception.SQLGrammarException: could not execute query using iterate
                              10:33:26,724 [JbpmScheduler] DEBUG JbpmContext : closing JbpmContext
                              10:33:26,724 [JbpmScheduler] DEBUG Services : closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@19a37a
                              10:33:26,724 [JbpmScheduler] DEBUG DbPersistenceService : committing hibernate transaction
                              10:33:26,724 [JbpmScheduler] DEBUG DbPersistenceService : closing hibernate session
                              10:33:26,724 [JbpmScheduler] INFO SchedulerThread : runtime exception while executing timers
                              org.jbpm.JbpmException: couldn't find timers from the database
                               at org.jbpm.db.SchedulerSession.findTimersByDueDate(SchedulerSession.java:88)
                               at org.jbpm.scheduler.impl.SchedulerThread.executeTimers(SchedulerThread.java:106)
                               at org.jbpm.scheduler.impl.SchedulerThread.run(SchedulerThread.java:70)
                              Caused by: org.hibernate.exception.SQLGrammarException: could not execute query using iterate
                               at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
                               at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
                               at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:410)
                               at org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:310)
                               at org.hibernate.engine.query.HQLQueryPlan.performIterate(HQLQueryPlan.java:170)
                               at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1139)
                               at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:46)
                               at org.jbpm.db.SchedulerSession.findTimersByDueDate(SchedulerSession.java:82)
                               ... 2 more
                              Caused by: java.sql.SQLException: Table not found in statement [select timer0_.ID_ as col_0_0_ from JBPM_TIMER timer0_ where (timer0_.EXCEPTION_ is null) and timer0_.ISSUSPENDED_<>1 order by timer0_.DUEDATE_ asc]
                               at org.hsqldb.jdbc.Util.throwError(Unknown Source)
                               at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
                               at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
                               at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:442)
                               at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:368)
                               at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
                               at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
                               at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:384)
                               ... 7 more