3 Replies Latest reply on Feb 7, 2006 3:03 PM by Tyler Black

    scheduler-service

    Hassan Mushtaq Newbie

      Hi, I wrote a class to be executed as a scheduled service, and made an entry accordingly in scheduler-service.xml, now that class is calling few session beans to do some processing. In JBoss 3.x, I had no problem running this, but in JBoss 4.x it is giving me classnotfound error on session beans. Now the scheduler-service starts before the deployment of application in both version of JBosses, but I do not know what is changed in underlying structure, that is causing this error. Now one way I thought to solve the problem was to make scheduler-service start after deployment of application. Now does anyone know how to do that?
      In JBoss admin guide it says,

      "StartAtStartup: A flag that determines if the Scheduler will start when it receives its startService life cycle notification. If true the Scheduler starts on its startup. If false, an explicit startSchedule operation must be invoked
      on the Scheduler to begin."

      Now how to do that explicit startSchedule operation??

      Thanks

        • 1. Re: scheduler-service
          Test Test Newbie

          I did the same way but for me, my class not even running!
          Could you help me how to run a scheduler which has to fire an event at every hour!

          • 2. Re: scheduler-service
            Tyler Black Newbie

             

            "hassanm" wrote:
            Hi, I wrote a class to be executed as a scheduled service, and made an entry accordingly in scheduler-service.xml
            ...

            Now one way I thought to solve the problem was to make scheduler-service start after deployment of application. Now does anyone know how to do that?


            How is your application deployed?
            How is the SchedulableClass that you wrote deployed?

            I would suggest one of 2 solutions:

            1. In scheduler-service.xml, after the opening element and before the elements, put a < depends > element with your application/service's name, that contains your SchedulableClass, as is appears in your jmx-console. Something like:
              <depends>hassanm:service=SuperCoolApp</depends>

            2. Package your SchedulableClass in a .jar and deploy it in the lib directory of your jboss configuration (all/default/whatever).


              Hope this helps.


            • 3. Re: scheduler-service
              Tyler Black Newbie

               

              "arshadsa" wrote:
              I did the same way but for me, my class not even running!
              Could you help me how to run a scheduler which has to fire an event at every hour!


              Edit scheduler-config.xml to say
              <mbean code="org.jboss.varia.scheduler.Scheduler"
               name=":service=Scheduler">
               <attribute name="StartAtStartup">true</attribute>
               <attribute name="SchedulableClass">your.fully.qualified.classname.GoesHere</attribute>
               <attribute name="SchedulableArguments">consructor param values go here</attribute>
               <attribute name="SchedulableArgumentTypes">constructor param types go here</attribute>
               <attribute name="InitialStartDate">0</attribute>
               <attribute name="SchedulePeriod">60000</attribute>
               <attribute name="InitialRepetitions">-1</attribute>
               </mbean>
              


              You class must implement org.jboss.varia.scheduler.Schedulable, and have a constructor with the parameters you specified.

              Hope this helps