1. 程式人生 > >使用宣告式啟動job任務時報JobInitializationPlugin或XMLSchedulingDataProcessorPlugin例項化失敗 解決方案

使用宣告式啟動job任務時報JobInitializationPlugin或XMLSchedulingDataProcessorPlugin例項化失敗 解決方案

org.quartz.SchedulerException: SchedulerPlugin class 'org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin' could not be instantiated. [See nested exception: java.lang.ClassNotFoundException: Unable to load class org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin by any known loaders.]
 at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1039)
 at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1525)
 at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerFactory.java:1541)
 at com.swh.jobweb.main.MyJob6Main.main(MyJob6Main.java:25)
在搞Quartz-Job專案時報如上的錯誤,如果你的quartz jar包已加,而且jar包也找到了XMLSchedulingDataProcessorPlugin類但執行時扔報上面的錯誤,則考慮quartz依賴的jar是否已加,可以把XMLSchedulingDataProcessorPlugin類拷貝專案中即可看到XMLSchedulingDataProcessorPlugin類還需要匯入哪些jar檔案,如下圖則可以看出需要JTA和quartz的jobs包(我用的是quartz-2.2.2,其它版本情況類似),所以quartz需要匯入的jar包有(2.2.x版):quartz-2.2.x.jar,quartz-jobs-2.2.x.jar和jta-1.1.jar