最近我尝试配置我的Grails应用程序与石英调度程序一起使用。不幸的是,我配置JDBC作业存储失败。石英插件似乎忽略quartz.properties
文件,其中表前缀被定义为Z_STAFF_SCHEDULER
。应用程序启动失败,出现异常:如何在grails 3中配置quartz插件?
引起:org.springframework.scheduling.SchedulingException:可能 无法启动Quartz Scheduler;嵌套的异常是 org.quartz.SchedulerConfigException:在作业 恢复期间发生故障。 [查看嵌套异常: org.quartz.impl.jdbcjobstore.LockException:获取db行失败 锁:表'testing.qrtz_locks'不存在[请参阅嵌套异常: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException :表 'testing.qrtz_locks' 不存在]
这里是application.groovy
相关代码:
quartz {
autoStartup = true
jdbcStore = true
waitForJobsToCompleteOnShutdown = true
exposeSchedulerInRepository = false
props {
scheduler.skipUpdateCheck = true
}
}
environments {
test {
quartz {
jdbcStore = false
autoStartup = false
}
}
}
grails.config.locations = ["classpath:conf/quartz.properties"]
,这是我在quartz.properties
配置:
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = StaffScheduler
org.quartz.scheduler.instanceId = AUTO
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 25
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = development
org.quartz.jobStore.tablePrefix = Z_STAFF_SCHEDULER_
org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000
#============================================================================
# Configure Datasources
#============================================================================
org.quartz.dataSource.development.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.development.URL = jdbc:mysql://localhost:3306/testing?useSSL=false
org.quartz.dataSource.development.user = testing
org.quartz.dataSource.development.password = nopass
org.quartz.dataSource.development.maxConnections = 10
org.quartz.dataSource.development.validationQuery = select 1
任何人谁可以帮助我吗?
我使用grails 3.2.3和quartz插件2.0.9
我用你的配置,但是,2017年7月7日16:39:18.602错误org.springframework.boot.SpringApplication.reportFailure - 应用程序启动失败 org.quartz .JobPersistenceException:无法获取作业名称:表'dev_erp2_db.z_staff_scheduler_job_details'不存在 – Denny
@denny您需要先为石英创建数据库模式。不幸的是,插件不会为你自己做。你可以在这里找到一个sql脚本:https://github.com/elventear/quartz-scheduler/blob/master/distribution/src/main/assembly/root/docs/dbTables/tables_mysql.sql – Fmeuer
非常感谢! – Denny