[英]How to configure quartz plugin in grails 3?
最近,我尝试配置grails应用程序以与石英调度程序一起使用。 不幸的是,我无法配置JDBC作业存储。 Z_STAFF_SCHEDULER
插件似乎忽略了quartz.properties
文件,其中表前缀定义为Z_STAFF_SCHEDULER
。 应用程序启动失败,发生以下异常:
引起原因:org.springframework.scheduling.SchedulingException:无法启动Quartz Scheduler。 嵌套的异常是org.quartz.SchedulerConfigException:作业恢复期间发生失败。 [请参见嵌套异常:org.quartz.impl.jdbcjobstore.LockException:无法获取数据库行锁:表'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和Crystal插件2.0.9
我终于找到了解决方案。 石英插件的每个选项都可以在application.yml
本身中配置。 有关受支持参数的列表,请参见http://www.quartz-scheduler.org/documentation/quartz-2.2.x/configuration/ 。
您不需要任何其他文件。 这是我的application.yml
的摘录作为示例:
quartz:
autoStartup: true
jdbcStore: true
scheduler:
instanceName: 'staff_scheduler'
instanceId: 'AUTO'
threadPool:
class: 'org.quartz.simpl.SimpleThreadPool'
threadCount: 25
threadPriority: 5
jobStore:
misfireThreshold: 60000
class: 'org.quartz.impl.jdbcjobstore.JobStoreTX'
driverDelegateClass: 'org.quartz.impl.jdbcjobstore.StdJDBCDelegate'
useProperties: false
dataSource: 'development'
tablePrefix: 'Z_STAFF_SCHEDULER_'
isClustered: true
clusterCheckinInterval: 20000
dataSource:
development:
driver: 'com.mysql.jdbc.Driver'
URL: 'jdbc:mysql://localhost:3306/testing?useSSL=false'
user: 'testing'
password: 'nopass'
maxConnections: 28
validationQuery: 'select 1'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.