I'm having trouble getting the XML plugin working with Quartz 2.2.1 under Tomcat7. I am initializing Quartz with the ServletContextListener. Without any job configuration I was able to get Quartz to start. Now I am trying to add the configuration for the jobs and it's crapping out.
Quartz config :
Code:
rg.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=5
org.quartz.scheduler.skipUpdateCheck=true
org.quartz.plugin.jobInitializer.class=org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin
org.quartz.plugin.jobInitializer.fileNames=quartz_data.xml
org.quartz.plugin.jobInitializer.failOnFileNotFound=true
org.quartz.plugin.jobInitializer.scanInterval=0
org.quartz.plugin.jobInitializer.wrapInUserTransaction=false
quartz_data.xml
Code:
<?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_2_0.xsd"
version="2.0">
<schedule>
<job>
<name>cancelOrdersJob</name>
<group>ORDER_JOBS_GROUP</group>
<description>Cancels orders</description>
<job-class>path/to/my/Job</job-class>
</job>
<trigger>
<simple>
<name>cancelOrdersTrigger</name>
<job-name>cancelOrdersJob</job-name>
<repeat-count>-1</repeat-count> <!-- repeat indefinitely -->
<repeat-interval>10000</repeat-interval> <!-- every 5 seconds -->
</simple>
</trigger>
</schedule>
</job-scheduling-data>
This gives the following error :
Code:
22:21:38.207 [ajp-bio-8009-exec-9] INFO o.q.e.s.QuartzInitializerListener - Quartz Initializer Servlet loaded, initializing Scheduler...
22:21:38.251 [ajp-bio-8009-exec-9] INFO o.q.i.StdSchedulerFactory - Using default implementation for ThreadExecutor
22:21:38.376 [ajp-bio-8009-exec-9] INFO o.q.c.SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
22:21:38.376 [ajp-bio-8009-exec-9] INFO o.q.c.QuartzScheduler - Quartz Scheduler v.2.2.1 created.
22:21:38.378 [ajp-bio-8009-exec-9] INFO o.q.p.x.XMLSchedulingDataProcessorPlugin - Registering Quartz Job Initialization Plug-in.
22:21:38.380 [ajp-bio-8009-exec-9] INFO o.q.s.RAMJobStore - RAMJobStore initialized.
22:21:38.381 [ajp-bio-8009-exec-9] INFO o.q.c.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.2.1) 'QuartzScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 5 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
22:21:38.382 [ajp-bio-8009-exec-9] INFO o.q.i.StdSchedulerFactory - Quartz scheduler 'QuartzScheduler' initialized from the specified file : 'quartz.properties' from the class resource path.
22:21:38.382 [ajp-bio-8009-exec-9] INFO o.q.i.StdSchedulerFactory - Quartz scheduler version: 2.2.1
22:21:38.436 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Utilizing schema packaged in local quartz distribution jar.
22:21:38.500 [ajp-bio-8009-exec-9] INFO o.q.x.XMLSchedulingDataProcessor - Parsing XML file: quartz_data.xml with systemId: quartz_data.xml
22:21:39.360 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Found 0 delete job group commands.
22:21:39.363 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Found 0 delete trigger group commands.
22:21:39.365 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Found 0 delete job commands.
22:21:39.367 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Found 0 delete trigger commands.
22:21:39.369 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Directive 'overwrite-existing-data' not specified, defaulting to true
22:21:39.370 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Directive 'ignore-duplicates' not specified, defaulting to false
22:21:39.372 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Found 1 job definitions.
22:21:39.426 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Parsed job definition: JobDetail 'ORDER_JOBS_GROUP.cancelOrdersJob': jobClass: 'my.package.CancelOrdersJob concurrentExectionDisallowed: true persistJobDataAfterExecution: false isDurable: false requestsRecovers: false
22:21:39.428 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Found 1 trigger definitions.
22:21:39.475 [ajp-bio-8009-exec-9] DEBUG o.q.x.XMLSchedulingDataProcessor - Parsed trigger definition: Trigger 'DEFAULT.cancelOrdersTrigger': triggerClass: 'org.quartz.impl.triggers.SimpleTriggerImpl calendar: 'null' misfireInstruction: 0 nextFireTime: null
22:21:39.475 [ajp-bio-8009-exec-9] INFO o.q.x.XMLSchedulingDataProcessor - Adding 1 jobs, 1 triggers.
22:21:39.476 [ajp-bio-8009-exec-9] INFO o.q.x.XMLSchedulingDataProcessor - Adding job: ORDER_JOBS_GROUP.cancelOrdersJob
22:21:39.487 [ajp-bio-8009-exec-9] ERROR o.q.p.x.XMLSchedulingDataProcessorPlugin - Error scheduling jobs: A new job defined without any triggers must be durable: ORDER_JOBS_GROUP.cancelOrdersJob
org.quartz.SchedulerException: A new job defined without any triggers must be durable: ORDER_JOBS_GROUP.cancelOrdersJob
Why is it telling me I have a job without a trigger? Isn't that what I have specified in the configuration? I built my config based off the example from example10. The documentation is no help either. It just says to RTFM er XSD basically. So I added changed the trigger to
Code:
<trigger>
<simple>
<name>cancelOrdersTrigger</name>
<job-name>cancelOrdersJob</job-name>
<repeat-count>-1</repeat-count> <!-- repeat indefinitely -->
<repeat-interval>10000</repeat-interval> <!-- every 5 seconds -->
<start-time-seconds-in-future>5</start-time-seconds-in-future>
</simple>
</trigger>
And this doesn't even pass the XML validation.
Code:
22:35:50.388 [ajp-bio-8009-exec-4] ERROR o.q.p.x.XMLSchedulingDataProcessorPlugin - Error scheduling jobs: Encountered 1 validation exceptions.
org.quartz.xml.ValidationException: Encountered 1 validation exceptions.
...
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.d: Invalid content was found starting with element 'start-time-seconds-in-future'. No child element is expected at this point.
I'm lost. All I want to do is start a scheduler when Tomcat7 starts, and have it fire off a job in the background continuously. How do I configure Quartz to do so?
Chris