Java Quartz JobStoreTX在数据库连接断开时连续记录异常
我已经用以下属性配置了JavaQuartz调度程序Java Quartz JobStoreTX在数据库连接断开时连续记录异常,java,postgresql,quartz-scheduler,Java,Postgresql,Quartz Scheduler,我已经用以下属性配置了JavaQuartz调度程序 在datasource配置类中 dataSource.setTestOnBorrow(true); dataSource.setTestWhileIdle(true); dataSource.setTestOnReturn(true); dataSource.setRollbackOnReturn(true); dataSource.setValidationQuery("SELECT 1");
在datasource配置类中
dataSource.setTestOnBorrow(true);
dataSource.setTestWhileIdle(true);
dataSource.setTestOnReturn(true);
dataSource.setRollbackOnReturn(true);
dataSource.setValidationQuery("SELECT 1");
dataSource.setRemoveAbandoned(true);
dataSource.setRemoveAbandonedTimeout(30);
这就是我的石英触发器的样子
return newTrigger()
.withIdentity("run_on_every_hour_trigger", "group1")
.startAt(evenHourDateAfterNow())
.withSchedule(repeatHourlyForever().withMisfireHandlingInstructionFireNow())
.forJob(batchJobDetail)
.build();
当数据库重新启动时,出现以下错误
[SchedulerThread]o.s.s.quartz.LocalDataSourceJobStore:无法回滚jdbc连接。此连接已关闭
org.postgresql.util.PSQLException:此连接已关闭。
在org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:820)~[postgresql-9.4-1201-jdbc41.jar:9.4]
在org.postgresql.jdbc2.AbstractJdbc2Connection.rollback(AbstractJdbc2Connection.java:837)~[postgresql-9.4-1201-jdbc41.jar:9.4]
at sun.reflect.GeneratedMethodAccessor75.invoke(未知源)~[na:na]
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)~[na:1.8.0\u 45]
在java.lang.reflect.Method.invoke(Method.java:497)~[na:1.8.0_45]
在org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)~[springloaded-1.2.4.RELEASE.jar:1.2.4.RELEASE]
在org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)~[tomcat-jdbc-8.0.28.jar:na]
在org.apache.tomcat.jdbc.pool.jdbinterceptor.invoke(jdbinterceptor.java:108)~[tomcat-jdbc-8.0.28.jar:na]
在org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:81)~[tomcat-jdbc-8.0.28.jar:na]
在com.sun.proxy.$Proxy36.rollback(未知源)~[na:na]
at sun.reflect.GeneratedMethodAccessor75.invoke(未知源)~[na:na]
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)~[na:1.8.0\u 45]
在java.lang.reflect.Method.invoke(Method.java:497)~[na:1.8.0_45]
在org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)~[springloaded-1.2.4.RELEASE.jar:1.2.4.RELEASE]
在org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.invoke(AttributeRestoringConnectionInvocationHandler.java:73)~[quartz-2.2.2.jar:na]
在com.sun.proxy.$Proxy37.rollback(未知源)~[na:na]
位于org.quartz.impl.jdbcjobstore.JobStoreSupport.rollbackConnection(JobStoreSupport.java:3662)[quartz-2.2.2.jar:na]
在org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3821)[quartz-2.2.2.jar:na]
在org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2756)[quartz-2.2.2.jar:na]
在org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:272)[quartz-2.2.2.jar:na]
我遇到的问题是,在很短的时间内(当服务器重新启动时)连续打印此错误10000多次,然后停止打印 如果有人能指导我找出原因/纠正问题,我将不胜感激
提前感谢quartz版本为2.2.2,是否找到解决方案?我发现了以下问题。已尝试验证,但似乎无法解决问题
return newTrigger()
.withIdentity("run_on_every_hour_trigger", "group1")
.startAt(evenHourDateAfterNow())
.withSchedule(repeatHourlyForever().withMisfireHandlingInstructionFireNow())
.forJob(batchJobDetail)
.build();