4

我遇到了 Quartz 1.8.4 的问题。“问题”(除了弄乱我的日志文件外,似乎对 Quartz 没有影响)如下所示。

问题:为什么会抛出这个异常?

Jun 20, 2012 12:33:29 PM org.quartz.impl.jdbcjobstore.JobStoreSupport storeTrigger
INFO: note: volatile triggers are effectively non-volatile in a clustered environment.
Jun 20, 2012 12:33:29 PM org.quartz.plugins.history.LoggingJobHistoryPlugin jobToBeExecuted
INFO: Job JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz_jobs_xml fired (by trigger JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz_jobs_xml) at:  12:33:29 06/20/2012
Jun 20, 2012 12:33:29 PM org.quartz.core.JobRunShell run
INFO: Job JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz_jobs_xml threw a JobExecutionException: 
org.quartz.JobExecutionException: FileScanListener named 'JobSchedulingDataLoaderPlugin_jobInitializer' not found in SchedulerContext
    at org.quartz.jobs.FileScanJob.execute(FileScanJob.java:83)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Jun 20, 2012 12:33:29 PM org.quartz.plugins.history.LoggingJobHistoryPlugin jobWasExecuted
WARNING: Job JobSchedulingDataLoaderPlugin.JobSchedulingDataLoaderPlugin_jobInitializer_quartz_jobs_xml execution failed at  12:33:29 06/20/2012 and reports: FileScanListener named 'JobSchedulingDataLoaderPlugin_jobInitializer' not found in SchedulerContext
org.quartz.JobExecutionException: FileScanListener named 'JobSchedulingDataLoaderPlugin_jobInitializer' not found in SchedulerContext
    at org.quartz.jobs.FileScanJob.execute(FileScanJob.java:83)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)

石英属性文件:

#============================================================================
# Configure Main Scheduler Properties  
#============================================================================

org.quartz.scheduler.instanceName = AcertJobScheduler
org.quartz.scheduler.instanceId = AcertJobScheduler
org.quartz.scheduler.skipUpdateCheck = true

#============================================================================
# Configure ThreadPool  
#============================================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true

#============================================================================
# Configure JobStore  
#============================================================================

org.quartz.jobStore.misfireThreshold = 60000

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_

org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000


#============================================================================
# Configure Datasources  
#============================================================================
<sanitized>

#============================================================================
# Configure Plugins 
#============================================================================
org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin

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 = 0
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">


<!-- SAP ACERT Synchronization Job-->
<schedule>
        <job>
            <name>AcertSapImport</name>
            <group>SapImport</group>

            <description>Synchronize the staff information from the HR SAP database
            to the ACERT users table; Locations, and org tree</description>
            <job-class>my.company.acert.sap_import.SapAcertSyncJob</job-class>
        </job>
        <trigger>
            <cron>
                <name>myTrigger</name>
                <group>SapImport</group>
                <job-name>AcertSapImport</job-name>
                <job-group>SapImport</job-group>
                <cron-expression>0 0 1 * * ?</cron-expression>
            </cron>
        </trigger>

        <job>
            <name>Nightly Course Maintenance</name>
            <group>Acert Maintenance</group>
            <description>Activates and deactivates courses and course versions based 
            on their started and end dates.</description>
            <job-class>my.company.acert.job.CourseMaintenanceJob</job-class>
        </job>
        <trigger>
            <cron>
                <name>courseTrigger</name>
                <group>Acert Maintenance</group>
                <job-name>Nightly Course Maintenance</job-name>
                <job-group>Acert Maintenance</job-group>
                <cron-expression>0 0 2 * * ?</cron-expression>
            </cron>
        </trigger>
        <job>
            <name>Historic Backup</name>
            <group>Acert Maintenance</group>
            <description>Runs the stored procedure to take a snapshot of acert at this date.</description>
            <job-class>my.company.acert.job.HistoricBackupJob</job-class>
        </job>
        <trigger>
            <cron>
                <name>historicBackupTrigger</name>
                <group>Acert Maintenance</group>
                <job-name>Historic Backup</job-name>
                <job-group>Acert Maintenance</job-group>
                <cron-expression>0 0 3 1 * ?</cron-expression>
            </cron>
        </trigger>
        <job>
            <name>Parse XMLs for OrgUnit Trees</name>
            <group>Org Tree</group>

            <description>Parses the xml files for the org tree and reporting org tree</description>
            <job-class>my.company.acert.sap_import.ParseTreeXMLJob</job-class>
        </job>
        <trigger>
            <cron>
                <name>parseOrgTreeTrigger</name>
                <group>Org Tree</group>
                <job-name>Parse XMLs for OrgUnit Trees</job-name>
                <job-group>Org Tree</job-group>
                <cron-expression>0 0 2 1 * ?</cron-expression>
            </cron>
        </trigger>
        <job>
            <name>Notify Expiry Courses</name>
            <group>Notifications</group>

            <description>Send email notification to supervisor and learners of current and upcoming course expirations.</description>
            <job-class>my.company.acert.job.NotifyCourseExpiryJob</job-class>
        </job>
        <trigger>
            <cron>
                <name>notifyExpiryCoursesTrigger</name>
                <group>Notifications</group>
                <job-name>Notify Expiry Courses</job-name>
                <job-group>Notifications</job-group>
                <cron-expression>0 0 3 * * ?</cron-expression>
            </cron>
        </trigger>

</schedule>
</job-scheduling-data>

我在 Tomcat 7.0.27 上运行它。

4

1 回答 1

0

我调试了代码并发现,当在调度程序上下文中找不到侦听器名称时会发生此异常。简而言之,请查看您要调用的类文件是否存在于类路径中,并且它们的路径是否在属性文件中正确设置。一个简单的拼写错误可能会导致此异常。一种简单的方法是首先只安排一个实例以查看它是否在没有警告的情况下工作,然后添加另一个实例并查看是否有警告等等。

  FileScanListener listener = (FileScanListener)schedCtxt.get(listenerName);

  if(listener == null) {
        throw new JobExecutionException("FileScanListener named '" + 
                    listenerName + "' not found in SchedulerContext");
  }

希望能帮助到你。

于 2013-07-14T06:06:40.673 回答