I am attempting to add a cron job to my webapp. I've added the Quartz and Quartz-Jobs 2.3.2 dependencies to my pom file, added the following to web.xml
<servlet>
<servlet-name>QuartzInitializer</servlet-name>
<servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
Using the default quartz.properties file
org.quartz.scheduler.instanceName: JobScheduler
org.quartz.scheduler.instanceId: AUTO
org.quartz.scheduler.skipUpdateCheck: true
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 3
org.quartz.threadPool.threadPriority: 5
org.quartz.jobStore.misfireThreshold: 60000
org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
org.quartz.plugin.jobInitializer.class: org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin
org.quartz.plugin.jobInitializer.fileNames: scheduler.xml
org.quartz.plugin.jobInitializer.failOnFileNotFound: true
org.quartz.plugin.jobInitializer.scanInterval: 120
org.quartz.plugin.jobInitializer.wrapInUserTransaction: false
and a simple Job class
public class HelloJob implements Job {
public void execute(JobExecutionContext context) throws JobExecutionException {
Logger logger = LogManager.getLogger(HelloJob.class);
logger.info("Hello World");
}
}
and the following scheduler.xml
<?xml version='1.0' encoding='utf-8'?>
<job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd"
version="1.8">
<schedule>
<job>
<name>helloJob</name>
<group>MYJOB_GROUP</group>
<job-class>myapp.utils.HelloJob</job-class>
</job>
<trigger>
<cron>
<name>my-trigger</name>
<group>MYTRIGGER_GROUP</group>
<job-name>helloJob</job-name>
<job-group>MYJOB_GROUP</job-group>
<cron-expression>0 * * * * ?</cron-expression>
</cron>
</trigger>
</schedule>
</job-scheduling-data>
As far as I can tell, this should output to my log every minute, and while I can see where the Scheduler is initialized and it indicates that it has started, I don't see any output from the job in my log file. What am I doing wrong?