2012-06-20 49 views
4

我遇到了Quartz 1.8.4的問題。下面顯示'問題'(對Quartz沒有影響,除了混亂我的日誌文件)。Quartz - JobSchedulingDataLoaderPlugin_jobInitializer'JobExecutionException'

問:爲什麼拋出這個異常?

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) 

quartz.properties文件:

#============================================================================ 
# 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運行此。

+0

看來調度程序無法找到quartz_jobs.xml文件,因此無法爲此構建上下文。然而,你說從.xml作業正在執行,這讓人想知道如何。 Quartz本身或您的配置都有問題。因此,只需在最新版本的Quartz上運行它即可縮小範圍。 – Shinchan

+0

你用scanInterval 10試過了嗎?它是否仍然有相同的警告?我的猜測是它無法獲得文件的鎖定 –

回答

0

我調試了代碼,發現在調度程序上下文中找不到偵聽器名稱時會發生此異常。簡而言之,請查看您要調用的類文件是否存在於類路徑中,並且它們的路徑是否在屬性文件中正確設置。一個簡單的拼寫錯誤可能會導致此異常。一個簡單的方法是首先安排一個實例,看看它是否在沒有警告的情況下工作,然後添加另一個實例並查看警告等。

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

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

希望它有幫助。