Quartz triggers not being saved to the mysql database

2.9k Views Asked by At

I am trying to save the quartz scheduler jobs to the database so that it can sustain server crash. And can start automatically on server start up. The problem is that I managed to save the job in the database but I can't see the trigger.

Any idea on this issue? I am using quartz 2.2.1 SimpleTrigger and also tried CronTrigger but no luck. Any help would be appreciated.

1

There are 1 best solutions below

0
On

This answer is just for the information of others asked for it in comment so posting my configuration for future reference of others, for me it was just configuration issue, I created the database tables manually. following is the configuration.

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

This was stored under the name of quartz.properties and was in classpath for quartz to find.