gpt4 book ai didi

java - 从失败中恢复的数据库错误 Qualtz

转载 作者:行者123 更新时间:2023-12-01 09:19:32 25 4
gpt4 key购买 nike

我将 Quartz 配置为使用数据库中的计划作业。现在,当我启动调度程序时:

try {
// Grab the Scheduler instance from the Factory
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();


// and start it off
scheduler.start();

scheduler.shutdown();

} catch (Exception se) {
Log.log(LogLevel.ERROR, se.getMessage());
}

项目的配置文件如下所示:

org.quartz.scheduler.instanceName = DatabaseScheduler
org.quartz.scheduler.skipUpdateCheck = true
org.quartz.threadPool.threadCount = 3

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.MSSQLDelegate
org.quartz.dataSource.myDB.driver = com.microsoft.sqlserver.jdbc.SQLServerDriver
org.quartz.dataSource.myDB.URL = jdbc:sqlserver://server:1433;databaseName=schedules
org.quartz.dataSource.myDB.user = sa
org.quartz.dataSource.myDB.password = password
org.quartz.dataSource.myDB.maxConnections = 2

org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.dataSource = myDB
org.quartz.scheduler.misfirePolicy = doNothing

我得到的错误是:

org.quartz.JobPersistenceException: Database error recovering from misfires. [See nested exception: java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3213)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3951)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3972)
Caused by: java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:62)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.acquireStatement(GooGooStatementCache.java:562)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.checkoutStatement(GooGooStatementCache.java:168)
at com.mchange.v2.c3p0.impl.NewPooledConnection.checkoutStatement(NewPooledConnection.java:234)
at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.invoke(AttributeRestoringConnectionInvocationHandler.java:73)
at com.sun.proxy.$Proxy3.prepareStatement(Unknown Source)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.countMisfiredTriggersInState(StdJDBCDelegate.java:390)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3192)
... 2 more

有人可以帮我解决这个错误吗?我也看过stackoverflow post 。没有任何运气。我正在使用 quartz 2.2.3。即使我的数据库表为空,我也会收到错误。

最佳答案

发现问题了。在我的源代码中,调度程序启动并立即关闭调度程序。在此期间,无法调度任何内容,并且在调用关闭之前调度程序的启动尚未完成。删除千钧一发后,它可以正常工作。

关于java - 从失败中恢复的数据库错误 Qualtz,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40259239/

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