gpt4 book ai didi

jdbcStore 的 Grails Quartz 插件错误

转载 作者:行者123 更新时间:2023-12-03 12:27:45 25 4
gpt4 key购买 nike

我尝试使用来自 Grails 的最新 quartz 插件:quartz:1.0.1。

如果我保留 jdbcStore = false,它会工作,如果我设置为 true,它会失败。QuartzConfig.groovy:

    quartz {
autoStartup = true
jdbcStore = true
waitForJobsToCompleteOnShutdown = true
exposeSchedulerInRepository = false

props {
scheduler.skipUpdateCheck = true
}
}

这是属性文件:

    org.quartz.scheduler.instanceName reporting_test
org.quartz.scheduler.instanceId AUTO

org.quartz.threadPool.class org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount 5
org.quartz.threadPool.threadPriority 5

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.tablePrefix QRTZ_
org.quartz.jobStore.isClustered true
org.quartz.jobStore.clusterCheckinInterval 5000

org.quartz.plugin.shutdownhook.class org.quartz.plugins.management.ShutdownHookPlugin
org.quartz.plugin.shutdownhook.cleanShutdown true

我一直在尝试使用 Datasource 设置进行试验,因为我更愿意使用在 Datasource.groovy 中设置的默认 DS。无论数据源的设置如何,我在启动时仍然会收到以下错误消息。

        2013-12-18 13:43:14,693 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.]
org.codehaus.groovy.runtime.InvokerInvocationException: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.]
at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:157)
at org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:113)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.executeInLock(JobStoreCMT.java:238)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:1086)
at org.quartz.core.QuartzScheduler.addJob(QuartzScheduler.java:969)
at org.quartz.core.QuartzScheduler.addJob(QuartzScheduler.java:958)
at org.quartz.impl.StdScheduler.addJob(StdScheduler.java:268)
at QuartzGrailsPlugin.scheduleJob(QuartzGrailsPlugin.groovy:268)
at QuartzGrailsPlugin$_closure5_closure23.doCall(QuartzGrailsPlugin.groovy:248)
at QuartzGrailsPlugin$_closure5.doCall(QuartzGrailsPlugin.groovy:247)
... 4 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:96)
... 13 more

这些表存在于我的数据库中。我实际上是将它们与用于 grails 的 quartz2 插件一起使用,但是出于各种原因决定试用这个插件。

关于我设置不正确的任何想法?

最佳答案

找到答案了。

正在运行一个查询来锁定行,在这种情况下失败时是:

SELECT * FROM QRTZ_LOCKS WHERE SCHED_NAME = 'reporting_test' AND LOCK_NAME = 'STATE_ACCESS' FOR UPDATE

FOR UPDATE 不适用于 MSSQL 数据库。我发现我使用了错误的委托(delegate)。我将我的属性(property)改为:

org.quartz.jobStore.driverDelegateClass org.quartz.impl.jdbcjobstore.MSSQLDelegate

这有效,希望这对其他人有帮助。

关于jdbcStore 的 Grails Quartz 插件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20667385/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com