0

I need to run a job at everyday 4 PM.For this I have written a cron scheduler (standlone class) by referring quartz examples.

Now I'm planning to deploy in on websphere. So that the scheduler can be started when I deploy the application and can bcome a part of the project.

I'm not finding any doc (step-by-step) on setting up quartz in app server. I have following doubts : 1. what all properties are required in properties file ? 2.Properties file always needed ? As none of the example on quartz website is using property file. 3. What all configuration files will be needed to achieve the above tasks and where to place them ?

Any doc or link will be highly appreciated.

Thanks in advance. hp

Nathaniel Waisbrot
  • 23,261
  • 7
  • 71
  • 99
Habin
  • 792
  • 1
  • 11
  • 21
  • Hi Habin, Did you find an answer to this question? I am trying to add the scheduler on Glassfish so that it will start with glassfish or when my app is deployed to glassfish. The docs are not very clear on this. Can you plps, put some light on this? – Dexter Oct 02 '15 at 17:48
  • Hey Nathaniel, I asked this question few years back :) . What I remember now is - I had written a scheduler using java.util.Timer to schedule job at a particular time each day (say 3.15 PM). Timer was then referenced from an [web]:http://stackoverflow.com/questions/809775/what-does-the-servlet-load-on-startup-value-signify "auto start servlet" . So, when you application gets deployed, the servlet will be instantiated automatically, which in-turns invoke the scheduler, and schedules the job. java.util.Timer also has methods to cancel the job. – Habin Oct 04 '15 at 17:02

1 Answers1

1

On the quartz's website you'll find everything you need to configure it.

Basically:

  • you need the quartz.properties
  • you'll need, somehow, to start the scheduler. You can achieve that by simply adding the QuartzInitializerListener to your web.xml. You can also integrate quartz with spring:

    <!-- quartz scheduler -->
    <bean id="my-quartz-factory"
       class="org.springframework.scheduling.quartz.SchedulerFactoryBean" >
        <property name="configLocation" value="classpath:spring/quartz.properties" />
    </bean>
    
  • All those files must be placed in your war.

HIH

poussma
  • 7,033
  • 3
  • 43
  • 68