user1516873
user1516873

Reputation: 5203

Quartz: How to reload jobs and triggers with org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin?

I want to use quartz in my small and simple web application. (Quartz 2.1.6 and tomcat 7.0.22). I want to change trigger cron expression without restart my application. I put jobs in xml file quartz-jobs.xml and set up XMLSchedulingDataProcessorPlugin in quartz.properties

Problem: when i change content of quartz-jobs.xml, quartz deceted file was changed and reload it, delete and create new job. I see it in log file. But content of this file is old (the same as it will on startup).

So i have in filesystem new version of quartz-jobs.xml, but quartz takes somewhere old version of that file.

Filesystem is plain ext4 with default setings.

So, how to refresh quartz jobs and triggers from xml file?

Here is my configuration:

quartz.properties:

org.quartz.scheduler.instanceName = SMSScheduler
org.quartz.threadPool.threadCount = 1
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
org.quartz.scheduler.skipUpdateCheck=true

org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin
org.quartz.plugin.jobInitializer.fileNames = quartz-jobs.xml
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
org.quartz.plugin.jobInitializer.scanInterval = 30
org.quartz.plugin.jobInitializer.wrapInUserTransaction = false

quartz-jobs.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">

    <pre-processing-commands>
        <delete-jobs-in-group>REPORT_GROUP</delete-jobs-in-group>
        <delete-triggers-in-group>REPORT_TRIGGER_GROUP</delete-triggers-in-group>
    </pre-processing-commands>
    <schedule>
        <job>
            <name>report-job</name>
            <group>REPORT_GROUP</group>
            <description>Create report</description>
            <job-class>com.company.quartz.ReportJob</job-class>
        </job>
        <trigger>
            <cron>
                <name>every-day-trigger</name>
                <group>REPORT_TRIGGER_GROUP</group>
                <job-name>report-job</job-name>

                <job-group>REPORT_GROUP</job-group>
                <!-- trigger every minute -->
                <cron-expression>0 * * * * ?</cron-expression>
            </cron>
        </trigger>
    </schedule>
</job-scheduling-data>

ReportJob.java

package com.company.quartz;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public class ReportJob implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
            System.out.println("test!");
    }
}

logs, where you can see check intervals and running job:

2012-11-22 11:47:20,169 INFO [pool-2-thread-1] [QuartzInitializerListener.java:contextInitialized:147] Quartz Initializer Servlet loaded, initializing Scheduler...
2012-11-22 11:47:20,223 INFO [pool-2-thread-1] [StdSchedulerFactory.java:instantiate:1157] Using default implementation for ThreadExecutor
2012-11-22 11:47:20,261 INFO [pool-2-thread-1] [SchedulerSignalerImpl.java:<init>:61] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2012-11-22 11:47:20,261 INFO [pool-2-thread-1] [QuartzScheduler.java:<init>:243] Quartz Scheduler v.2.1.6 created.
2012-11-22 11:47:20,263 INFO [pool-2-thread-1] [XMLSchedulingDataProcessorPlugin.java:initialize:202] Registering Quartz Job Initialization Plug-in.
2012-11-22 11:47:20,264 INFO [pool-2-thread-1] [RAMJobStore.java:initialize:154] RAMJobStore initialized.
2012-11-22 11:47:20,266 INFO [pool-2-thread-1] [QuartzScheduler.java:initialize:268] Scheduler meta-data: Quartz Scheduler (v2.1.6) 'SMSScheduler' 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 1 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

2012-11-22 11:47:20,266 INFO [pool-2-thread-1] [StdSchedulerFactory.java:instantiate:1306] Quartz scheduler 'SMSScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
2012-11-22 11:47:20,266 INFO [pool-2-thread-1] [StdSchedulerFactory.java:instantiate:1310] Quartz scheduler version: 2.1.6
2012-11-22 11:47:20,275 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessorPlugin.java:start:254] Scheduled file scan job for data file: quartz-jobs.xml, at interval: 10000
2012-11-22 11:47:20,280 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:resolveSchemaSource:239] Utilizing schema packaged in local quartz distribution jar.
2012-11-22 11:47:20,283 INFO [pool-2-thread-1] [XMLSchedulingDataProcessor.java:processFile:498] Parsing XML file: quartz-jobs.xml with systemId: quartz-jobs.xml
2012-11-22 11:47:20,358 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:549] Found 1 delete job group commands.
2012-11-22 11:47:20,365 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:563] Found 1 delete trigger group commands.
2012-11-22 11:47:20,367 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:577] Found 0 delete job commands.
2012-11-22 11:47:20,368 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:594] Found 0 delete trigger commands.
2012-11-22 11:47:20,375 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:614] Directive 'overwrite-existing-data' not specified, defaulting to true
2012-11-22 11:47:20,377 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:624] Directive 'ignore-duplicates' not specified, defaulting to false
2012-11-22 11:47:20,378 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:638] Found 1 job definitions.
2012-11-22 11:47:20,398 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:674] Parsed job definition: JobDetail 'REPORT_GROUP.report-job':  jobClass: 'com.company.quartz.ReportJob concurrentExectionDisallowed: false persistJobDataAfterExecution: false isDurable: false requestsRecovers: false
2012-11-22 11:47:20,407 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:686] Found 1 trigger definitions.
2012-11-22 11:47:20,451 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:817] Parsed trigger definition: Trigger 'REPORT_TRIGGER_GROUP.every-day-trigger':  triggerClass: 'org.quartz.impl.triggers.CronTriggerImpl calendar: 'null' misfireInstruction: 0 nextFireTime: null
2012-11-22 11:47:20,457 INFO [pool-2-thread-1] [XMLSchedulingDataProcessor.java:executePreProcessCommands:962] Deleting all jobs in group: REPORT_GROUP
2012-11-22 11:47:20,461 INFO [pool-2-thread-1] [XMLSchedulingDataProcessor.java:executePreProcessCommands:983] Deleting all triggers in group: REPORT_TRIGGER_GROUP
2012-11-22 11:47:20,461 INFO [pool-2-thread-1] [XMLSchedulingDataProcessor.java:scheduleJobs:1021] Adding 1 jobs, 1 triggers.
2012-11-22 11:47:20,461 INFO [pool-2-thread-1] [XMLSchedulingDataProcessor.java:scheduleJobs:1046] Adding job: REPORT_GROUP.report-job
2012-11-22 11:47:20,462 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:scheduleJobs:1107] Scheduling job: REPORT_GROUP.report-job with trigger: REPORT_TRIGGER_GROUP.every-day-trigger
2012-11-22 11:47:20,471 INFO [pool-2-thread-1] [QuartzScheduler.java:start:534] Scheduler SMSScheduler_$_NON_CLUSTERED started.
2012-11-22 11:47:20,472 INFO [pool-2-thread-1] [QuartzInitializerListener.java:contextInitialized:199] Scheduler has been started...
2012-11-22 11:47:20,472 INFO [pool-2-thread-1] [QuartzInitializerListener.java:contextInitialized:217] Storing the Quartz Scheduler Factory in the servlet context at key: org.quartz.impl.StdSchedulerFactory.KEY
2012-11-22 11:47:20,481 DEBUG [SMSScheduler_QuartzSchedulerThread] [QuartzSchedulerThread.java:run:268] batch acquisition of 1 triggers
2012-11-22 11:47:20,493 DEBUG [SMSScheduler_QuartzSchedulerThread] [SimpleJobFactory.java:newJob:51] Producing instance of Job 'JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml', class=org.quartz.jobs.FileScanJob
2012-11-22 11:47:20,516 DEBUG [SMSScheduler_Worker-1] [JobRunShell.java:run:212] Calling execute on job JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml
2012-11-22 11:47:20,517 DEBUG [SMSScheduler_Worker-1] [FileScanJob.java:execute:138] File 'quartz-jobs.xml' unchanged.
2012-11-22 11:47:20,517 DEBUG [SMSScheduler_QuartzSchedulerThread] [QuartzSchedulerThread.java:run:268] batch acquisition of 1 triggers
2012-11-22 11:47:30,272 DEBUG [SMSScheduler_QuartzSchedulerThread] [SimpleJobFactory.java:newJob:51] Producing instance of Job 'JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml', class=org.quartz.jobs.FileScanJob
2012-11-22 11:47:30,272 DEBUG [SMSScheduler_Worker-1] [JobRunShell.java:run:212] Calling execute on job JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml
2012-11-22 11:47:30,272 DEBUG [SMSScheduler_Worker-1] [FileScanJob.java:execute:138] File 'quartz-jobs.xml' unchanged.
2012-11-22 11:47:30,273 DEBUG [SMSScheduler_QuartzSchedulerThread] [QuartzSchedulerThread.java:run:268] batch acquisition of 1 triggers
2012-11-22 11:47:40,271 DEBUG [SMSScheduler_QuartzSchedulerThread] [SimpleJobFactory.java:newJob:51] Producing instance of Job 'JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml', class=org.quartz.jobs.FileScanJob
2012-11-22 11:47:40,272 DEBUG [SMSScheduler_Worker-1] [JobRunShell.java:run:212] Calling execute on job JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml
2012-11-22 11:47:40,272 DEBUG [SMSScheduler_Worker-1] [FileScanJob.java:execute:138] File 'quartz-jobs.xml' unchanged.
2012-11-22 11:47:40,272 DEBUG [SMSScheduler_QuartzSchedulerThread] [QuartzSchedulerThread.java:run:268] batch acquisition of 1 triggers
2012-11-22 11:47:50,271 DEBUG [SMSScheduler_QuartzSchedulerThread] [SimpleJobFactory.java:newJob:51] Producing instance of Job 'JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml', class=org.quartz.jobs.FileScanJob
2012-11-22 11:47:50,271 DEBUG [SMSScheduler_Worker-1] [JobRunShell.java:run:212] Calling execute on job JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml
2012-11-22 11:47:50,271 DEBUG [SMSScheduler_Worker-1] [FileScanJob.java:execute:138] File 'quartz-jobs.xml' unchanged.
2012-11-22 11:47:50,273 DEBUG [SMSScheduler_QuartzSchedulerThread] [QuartzSchedulerThread.java:run:268] batch acquisition of 1 triggers
2012-11-22 11:48:00,001 DEBUG [SMSScheduler_QuartzSchedulerThread] [SimpleJobFactory.java:newJob:51] Producing instance of Job 'REPORT_GROUP.report-job', class=com.company.quartz.ReportJob
2012-11-22 11:48:00,003 DEBUG [SMSScheduler_Worker-1] [JobRunShell.java:run:212] Calling execute on job REPORT_GROUP.report-job
2012-11-22 11:48:00,003 ERROR [SMSScheduler_Worker-1] [ReportJob.java:execute:31] test
2012-11-22 11:48:00,289 DEBUG [SMSScheduler_QuartzSchedulerThread] [QuartzSchedulerThread.java:run:268] batch acquisition of 1 triggers
2012-11-22 11:48:00,290 DEBUG [SMSScheduler_QuartzSchedulerThread] [SimpleJobFactory.java:newJob:51] Producing instance of Job 'JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml', class=org.quartz.jobs.FileScanJob
2012-11-22 11:48:00,290 DEBUG [SMSScheduler_Worker-1] [JobRunShell.java:run:212] Calling execute on job JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml
2012-11-22 11:48:00,290 DEBUG [SMSScheduler_Worker-1] [FileScanJob.java:execute:138] File 'quartz-jobs.xml' unchanged.
2012-11-22 11:48:00,290 DEBUG [SMSScheduler_QuartzSchedulerThread] 

next i change content of quartz-jobs.xml, made it invalid, so i expect see xml parser error, but nothing changes:

2012-11-22 11:51:20,280 DEBUG [SMSScheduler_QuartzSchedulerThread] [QuartzSchedulerThread.java:run:268] batch acquisition of 1 triggers
2012-11-22 11:51:30,271 DEBUG [SMSScheduler_QuartzSchedulerThread] [SimpleJobFactory.java:newJob:51] Producing instance of Job 'JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml', class=org.quartz.jobs.FileScanJob
2012-11-22 11:51:30,272 DEBUG [SMSScheduler_Worker-1] [JobRunShell.java:run:212] Calling execute on job JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml
2012-11-22 11:51:30,272 INFO [SMSScheduler_Worker-1] [FileScanJob.java:execute:135] File 'quartz-jobs.xml' updated, notifying listener.
2012-11-22 11:51:30,273 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:resolveSchemaSource:239] Utilizing schema packaged in local quartz distribution jar.
2012-11-22 11:51:30,277 INFO [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:processFile:498] Parsing XML file: quartz-jobs.xml with systemId: quartz-jobs.xml
2012-11-22 11:51:30,306 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:549] Found 1 delete job group commands.
2012-11-22 11:51:30,308 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:563] Found 1 delete trigger group commands.
2012-11-22 11:51:30,310 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:577] Found 0 delete job commands.
2012-11-22 11:51:30,312 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:594] Found 0 delete trigger commands.
2012-11-22 11:51:30,313 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:614] Directive 'overwrite-existing-data' not specified, defaulting to true
2012-11-22 11:51:30,314 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:624] Directive 'ignore-duplicates' not specified, defaulting to false
2012-11-22 11:51:30,315 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:638] Found 1 job definitions.
2012-11-22 11:51:30,327 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:674] Parsed job definition: JobDetail 'REPORT_GROUP.report-job':  jobClass: 'com.company.quartz.ReportJob concurrentExectionDisallowed: false persistJobDataAfterExecution: false isDurable: false requestsRecovers: false
2012-11-22 11:51:30,328 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:686] Found 1 trigger definitions.
2012-11-22 11:51:30,351 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:process:817] Parsed trigger definition: Trigger 'REPORT_TRIGGER_GROUP.every-day-trigger':  triggerClass: 'org.quartz.impl.triggers.CronTriggerImpl calendar: 'null' misfireInstruction: 0 nextFireTime: null
2012-11-22 11:51:30,351 INFO [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:executePreProcessCommands:962] Deleting all jobs in group: REPORT_GROUP
2012-11-22 11:51:30,352 INFO [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:executePreProcessCommands:983] Deleting all triggers in group: REPORT_TRIGGER_GROUP
2012-11-22 11:51:30,352 INFO [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:scheduleJobs:1021] Adding 1 jobs, 1 triggers.
2012-11-22 11:51:30,352 INFO [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:scheduleJobs:1046] Adding job: REPORT_GROUP.report-job
2012-11-22 11:51:30,352 DEBUG [SMSScheduler_Worker-1] [XMLSchedulingDataProcessor.java:scheduleJobs:1107] Scheduling job: REPORT_GROUP.report-job with trigger: REPORT_TRIGGER_GROUP.every-day-trigger
2012-11-22 11:51:30,353 DEBUG [SMSScheduler_QuartzSchedulerThread] [QuartzSchedulerThread.java:run:268] batch acquisition of 1 triggers

After that i restart tomcat, and error is here! But why it appears only after restarting?

2012-11-22 12:03:38,740 INFO [pool-2-thread-1] [QuartzScheduler.java:<init>:243] Quartz Scheduler v.2.1.6 created.
2012-11-22 12:03:38,741 INFO [pool-2-thread-1] [XMLSchedulingDataProcessorPlugin.java:initialize:202] Registering Quartz Job Initialization Plug-in.
2012-11-22 12:03:38,743 INFO [pool-2-thread-1] [RAMJobStore.java:initialize:154] RAMJobStore initialized.
2012-11-22 12:03:38,744 INFO [pool-2-thread-1] [QuartzScheduler.java:initialize:268] Scheduler meta-data: Quartz Scheduler (v2.1.6) 'SMSScheduler' 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 1 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

2012-11-22 12:03:38,744 INFO [pool-2-thread-1] [StdSchedulerFactory.java:instantiate:1306] Quartz scheduler 'SMSScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
2012-11-22 12:03:38,744 INFO [pool-2-thread-1] [StdSchedulerFactory.java:instantiate:1310] Quartz scheduler version: 2.1.6
2012-11-22 12:03:38,753 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessorPlugin.java:start:254] Scheduled file scan job for data file: quartz-jobs.xml, at interval: 10000
2012-11-22 12:03:38,757 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:resolveSchemaSource:239] Utilizing schema packaged in local quartz distribution jar.
2012-11-22 12:03:38,761 INFO [pool-2-thread-1] [XMLSchedulingDataProcessor.java:processFile:498] Parsing XML file: quartz-jobs.xml with systemId: quartz-jobs.xml
2012-11-22 12:03:38,837 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:549] Found 1 delete job group commands.
2012-11-22 12:03:38,838 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:563] Found 1 delete trigger group commands.
2012-11-22 12:03:38,847 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:577] Found 0 delete job commands.
2012-11-22 12:03:38,848 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:594] Found 0 delete trigger commands.
2012-11-22 12:03:38,850 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:614] Directive 'overwrite-existing-data' not specified, defaulting to true
2012-11-22 12:03:38,851 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:624] Directive 'ignore-duplicates' not specified, defaulting to false
2012-11-22 12:03:38,861 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:638] Found 1 job definitions.
2012-11-22 12:03:38,880 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:674] Parsed job definition: JobDetail 'REPORT_GROUP.report-job':  jobClass: 'com.company.quartz.ReportJob concurrentExectionDisallowed: false persistJobDataAfterExecution: false isDurable: false requestsRecovers: false
2012-11-22 12:03:38,882 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:686] Found 1 trigger definitions.
2012-11-22 12:03:38,920 DEBUG [pool-2-thread-1] [XMLSchedulingDataProcessor.java:process:817] Parsed trigger definition: Trigger 'REPORT_TRIGGER_GROUP.every-day-trigger':  triggerClass: 'org.quartz.impl.triggers.CronTriggerImpl calendar: 'null' misfireInstruction: 0 nextFireTime: null
2012-11-22 12:03:38,938 ERROR [pool-2-thread-1] [XMLSchedulingDataProcessorPlugin.java:processFile:335] Error scheduling jobs: Encountered 1 validation exceptions.
org.quartz.xml.ValidationException: Encountered 1 validation exceptions.
    at org.quartz.xml.XMLSchedulingDataProcessor.maybeThrowValidationException(XMLSchedulingDataProcessor.java:1256) ~[quartz-2.1.6.jar:na]
    at org.quartz.xml.XMLSchedulingDataProcessor.processFile(XMLSchedulingDataProcessor.java:505) ~[quartz-2.1.6.jar:na]
    at org.quartz.xml.XMLSchedulingDataProcessor.processFileAndScheduleJobs(XMLSchedulingDataProcessor.java:886) ~[quartz-2.1.6.jar:na]
    at org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin.processFile(XMLSchedulingDataProcessorPlugin.java:330) [quartz-2.1.6.jar:na]
    at org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin.start(XMLSchedulingDataProcessorPlugin.java:257) [quartz-2.1.6.jar:na]
    at org.quartz.plugins.SchedulerPluginWithUserTransactionSupport.start(SchedulerPluginWithUserTransactionSupport.java:144) [quartz-2.1.6.jar:na]
    at org.quartz.core.QuartzScheduler.startPlugins(QuartzScheduler.java:2343) [quartz-2.1.6.jar:na]
    at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:527) [quartz-2.1.6.jar:na]
    at org.quartz.impl.StdScheduler.start(StdScheduler.java:143) [quartz-2.1.6.jar:na]
    at org.quartz.ee.servlet.QuartzInitializerListener.contextInitialized(QuartzInitializerListener.java:198) [quartz-2.1.6.jar:na]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779) [catalina.jar:7.0.27]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273) [catalina.jar:7.0.27]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.27]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895) [catalina.jar:7.0.27]
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871) [catalina.jar:7.0.27]
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615) [catalina.jar:7.0.27]
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099) [catalina.jar:7.0.27]
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621) [catalina.jar:7.0.27]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_32]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_32]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_32]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_32]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_32]
    at java.lang.Thread.run(Thread.java:662) [na:1.6.0_32]
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.3: Element 'cron' cannot have character [children], because the type's content type is element-only.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:423) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3188) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3151) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3111) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3013) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2156) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:824) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2939) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232) ~[na:1.6.0_32]
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284) ~[na:1.6.0_32]
    at org.quartz.xml.XMLSchedulingDataProcessor.process(XMLSchedulingDataProcessor.java:539) ~[quartz-2.1.6.jar:na]
    at org.quartz.xml.XMLSchedulingDataProcessor.processFile(XMLSchedulingDataProcessor.java:503) ~[quartz-2.1.6.jar:na]
    ... 22 common frames omitted
2012-11-22 12:03:38,947 INFO [pool-2-thread-1] [QuartzScheduler.java:start:534] Scheduler SMSScheduler_$_NON_CLUSTERED started.
2012-11-22 12:03:38,947 INFO [pool-2-thread-1] [QuartzInitializerListener.java:contextInitialized:199] Scheduler has been started...
2012-11-22 12:03:38,947 INFO [pool-2-thread-1] [QuartzInitializerListener.java:contextInitialized:217] Storing the Quartz Scheduler Factory in the servlet context at key: org.quartz.impl.StdSchedulerFactory.KEY
2012-11-22 12:03:38,950 DEBUG [SMSScheduler_QuartzSchedulerThread] [QuartzSchedulerThread.java:run:268] batch acquisition of 1 triggers
2012-11-22 12:03:39,002 DEBUG [SMSScheduler_QuartzSchedulerThread] [SimpleJobFactory.java:newJob:51] Producing instance of Job 'JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz-jobs_xml', class=org.quartz.jobs.FileScanJob

EDIT: reported to terracota https://jira.terracotta.org/jira/browse/QTZ-334

Upvotes: 2

Views: 18597

Answers (2)

gubs
gubs

Reputation: 439

We built a small java project for our business needs with quartz.properties and quartz_jobs.xml with the same configuration mentioned, but without Tomcat (Java application project).

Even in the small program, after starting the Java class (scheduler.start()), modifying the quartz-jobs.xml did not trigger the cron based on the expression change.

To solve, I provided the absolute path in quartz.properties, and then the cron expression changes were picked up by the scheduler Factory.

Upvotes: 2

poussma
poussma

Reputation: 7321

You should try to specify the absolute path to your quartz-jobs.xml file to avoid the issue of tomcat not reloading the files in the webapp context even when they are changed.

Upvotes: 5

Related Questions