当前位置: 首页 > 面试题库 >

Quartz:如何使用org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin重新加载作业和触发器?

公羊瀚
2023-03-14
问题内容

我想在小型和简单的Web应用程序中使用石英。(Quartz 2.1.6和tomcat
7.0.22)。我想更改触发器cron表达式而无需重新启动应用程序。我把工作放在xml文件中quartz- jobs.xmlXMLSchedulingDataProcessorPluginquartz.properties

问题:当我更改的内容时quartz- jobs.xml,石英胶粘剂文件已更改并重新加载,删除并创建新作业。我在日志文件中看到它。但是此文件的内容很旧(与启动时一样)。

所以我在文件系统中有新版本的quartz-jobs.xml,但是quartz需要该文件的旧版本。

文件系统是具有默认设置的普通ext4。

那么,如何从xml文件刷新石英作业和触发器?

这是我的配置

crystal.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

石英作业.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!");
    }
}

日志,您可以在其中查看检查间隔和正在运行的作业:

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]

接下来,我更改的内容quartz-jobs.xml,使其无效,因此我希望看到xml解析器错误,但没有任何变化:

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

之后,我重新启动tomcat,并且错误在这里!但是,为什么仅在重新启动后才出现?

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

编辑:报告给terracota
https://jira.terracotta.org/jira/browse/QTZ-334


问题答案:

您应该尝试指定quartz-jobs.xml文件的绝对路径,以免tomcat出现问题,即使它们已更改,也无法在webapp上下文中不重新加载文件。



 类似资料:
  • 我有一个工作,将连续访问一个数据库,并计算一个表中的行数。当数量达到某个阈值时,作业必须停止检查表并触发一些新的作业。现在,我正在尝试使用来执行此操作,但我不确定如何删除第一个作业。即: (2)当有5行时,Job1将。 (3)现在Job2需要启动,Job1必须停止运行。如何删除Job1?我知道,但我不确定何时或何处调用它,因为我不能在类中为更改。 此外,我如何触发Job2开始运行在这一点?我已经读

  • 我正在使用Quartz调度器在我的java-app中启动作业。我有作业 用几个触发器启动一个作业是不可能的吗?我能以某种方式生成一个考虑多个cron表达式的调度吗?

  • 问题内容: 我对Quartz有点陌生。有没有一种方法可以更新已经提交的Quartz作业的作业执行间隔?这个间隔会立即更新吗?重新安排工作后,您是否必须再次开始工作? 我找到了以下链接,但由于我的石英罐不包含该链接中使用的某些类,因此我不知道代码所引用的库。另外,triggerKey方法从何而来?这是静态导入吗? http://www.quartz- scheduler.org/documentat

  • 我希望在我的一个JUnit测试用例中将作业执行间隔更新为一个非常大的数字,因为我不希望作业干扰被测试类的状态。一旦测试用例完成,我希望将作业执行间隔重置为将在生产中使用的实际值