7 Replies Latest reply on Jan 22, 2007 5:07 AM by Jesper Berglund

    Scheduler problems jbpm.war(3.1.3) to jboss as 4.0.5GA

    Jesper Berglund Newbie

      I have spent the last couple of days trying to get the scheduler to work on JBoss 4.0.5 GA but when a task with a timer is executed the 'scheduler' is not found.
      I have downloaded the 3.1.3 jbpm starter kit and modded it to work (as in previous posts).
      I have copied the jbpm.sar and the jbpm.war to the dir. I removed dom4j and jaxen jars from the war (hence it is already included in the jboss dist) and added the following in the web.xml to load the scheduler thread.

      <!-- jBPM SchedulerServlet -->

      I have verified that the scheduler is running:
      DEBUG [Scheduler] starting the scheduler
      DEBUG [CommandExecutorThread] waiting for more messages
      DEBUG [JbpmContextInfo] creating jbpm context with service factories '[message, scheduler, authentication, persistence, logging]'
      DEBUG [JbpmContext] creating JbpmContext
      DEBUG [DbPersistenceServiceFactory] creating persistence service
      DEBUG [DbPersistenceService] creating hibernate session
      DEBUG [DbPersistenceService] beginning hibernate transaction
      DEBUG [SchedulerThread] checking for timers
      DEBUG [JbpmContext] closing JbpmContext
      DEBUG [Services] closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@1d427b1
      DEBUG [DbPersistenceService] committing hibernate transaction
      DEBUG [DbPersistenceService] closing hibernate session

      This is the code that creates and executes the process:

       ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       " <start-state>" +
       " <transition to='executeAction' />" +
       " </start-state>" +
       " <node name='executeAction'>" +
       " <transition to='timedAction' />" +
       " <action class='se.pertexo.test.workflow.TestAction' />" +
       " </node>" +
       " <node name='timedAction'>" +
       " <timer name='timer1' duedate='15 seconds'/>" +
       " <transition to='end' />" +
       " <action class='se.pertexo.test.workflow.TestAction' />" +
       " </node>" +
       " <end-state name='end' />" +
       ProcessInstance processInstance =
       new ProcessInstance( processDefinition );
       Token token = processInstance.getRootToken();
       logger.info( " Starting workflow" );

      The TestAction code:

      public class TestAction implements ActionHandler
       private static Logger logger = Logger.getLogger( TestAction.class );
       public void execute(ExecutionContext executionContext) throws Exception
       logger.info( "Test action: execute");

      The first nodes action is executed and signals the transition to the timer task, this is the log and exception I get:

      11:35:33,058 INFO [TestBean] -----> Testing jBPM <-----
      11:35:33,151 INFO [TestBean] Starting workflow
      11:35:33,167 INFO [TestAction] Test action: execute
      11:35:33,167 ERROR [GraphElement] action threw exception: service 'scheduler' unavailable
      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.exe.Token.signal(Token.java:178)
       at org.jbpm.graph.exe.Token.signal(Token.java:123)
       at se.sqs.production.workflow.TestAction.execute(TestAction.java:22)

      My question is:
      Where does the scheduler get registered with the JbpmContext?

      Is there anything else that I have missed?