2015-06-11 99 views
0

我試圖將石英調度程序作業保存到數據庫,以便它可以承受服務器崩潰。並且可以在服務器啓動時自動啓動。問題是我設法將作業保存在數據庫中,但我看不到觸發器。石英觸發器沒有被保存到mysql數據庫

關於這個問題的任何想法?我使用石英2.2.1 SimpleTrigger,也嘗試過CronTrigger,但沒有運氣。任何幫助,將不勝感激。

+0

你能發佈你的配置文件嗎(quartz.properties是默認的)?目前還不清楚,你可以看到你的數據庫作業,但沒有觸發器? – dylaniato

+0

我遇到同樣的問題,只有jobDetails表已歸檔,其餘全部爲空。你有沒有想過? –

+0

是的,你必須重寫quartz.properties文件。並把它放在你的類路徑中,這是唯一的問題。你還必須創建表或配置來觸發腳本http://quartz-scheduler.org/documentation/quartz-2.x/configuration/此鏈接將有助於.. :) :)我也發佈quartz.properties以供回答參考(因爲我不能在這裏粘貼;))。 –

回答

1

這個答案只是針對別人提供的信息,所以發佈我的配置以供將來參考其他人使用,對我來說這只是配置問題,我手動創建了數據庫表。以下是配置。

org.quartz.scheduler.instanceName = quartzScheduler 
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX 
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate 
org.quartz.jobStore.tablePrefix = qrtz_ 
org.quartz.jobStore.dataSource = quartzDataSource 
org.quartz.jobStore.useProperties=false 
org.quartz.scheduler.skipUpdateCheck=true 


# Following is to be changed according to database. 
org.quartz.dataSource.quartzDataSource.driver = com.mysql.jdbc.Driver 
org.quartz.dataSource.quartzDataSource.URL=jdbc:mysql://localhost:3306/test 
org.quartz.dataSource.quartzDataSource.user = root 
org.quartz.dataSource.quartzDataSource.password = root 
# This should be equal to or more than the number of thread configured below. 
org.quartz.dataSource.quartzDataSource.maxConnections = 30 

#org.quartz.jobStore.isClustered = false 


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



org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin 
org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger {1}.{0} fired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy} 
org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH:mm:ss MM/dd/yyyy} 
org.quartz.plugin.triggHistory.triggerMisfiredMessage = Trigger {1}.{0} misfired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy}. Should have fired at: {3, date, HH:mm:ss MM/dd/yyyy} 
org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin 
org.quartz.plugin.shutdownhook.cleanShutdown = true 

# It's plugin that chaeck the configuration file every 10 seconds and updates the database accordingly. 
# NOT NEEDED 
#org.quartz.plugin.jobInitializer.class=org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin 
#org.quartz.plugin.jobInitializer.fileNames=quartz-scheduler.xml 
#org.quartz.plugin.jobInitializer.failOnFileNotFound=true 
#org.quartz.plugin.jobInitializer.scanInterval= 10 
#org.quartz.plugin.jobInitializer.wrapInUserTransaction=false 

這是以quartz.properties的名稱存儲的,並且在類路徑中用於尋找石英。