Quartz学习笔记(四) 集群访问异常

问题描述

 

在Quartz使用集群的情况下,打开浏览器访问定时任务列表,当闲置一段时间,再次刷新定时任务列表或者点击定时任务操作按钮,

程序抛出如下异常:

org.quartz.JobPersistenceException: Couldn't obtain triggers for job: No operations allowed after statement closed. [See nested exception: java.sql.SQLException: No operations allowed after statement closed.]

Caused by: java.sql.SQLException: No operations allowed after statement closed.

 

问题跟踪

 

检查MySQL数据库等待超时时间:

show global variables like 'wait_timeout';

值为600(单位为秒)

 

 

问题解决

 

方案1:

设置变量值命令

set global wait_timeout=28800

(其默认时间为长度为28800秒,就是8个小时)

 

方案2:

新建独立的数据库,调度中心模块化。

 

方案3:

设置Quartz数据源连接校验参数。

在quartz.properties文件中添加如下配置

org.quartz.dataSource.qzDS.validationQuery: select 0

 

 

 

你可能感兴趣的:(quartz,集群异常)