quartz在web中时有罢工(转)

quartz集成到tomcat采用是使用 ServletContextListener方案,参见http://www.blogjava.net/Unmi/archive/2008/05/01/197657.html

tomcat运行一段时间后,控制台报以下错误
2009-03-06 09:38:21 [org.quartz.core.ErrorLogger]-[ERROR] An error occured while scanning for the next trigger to fire.
org.quartz.JobPersistenceException: Couldn't rollback jdbc connection. Io 异常: Connection reset by peer: socket write error [See nested exception: java.sql.SQLException: Io 异常: Connection reset by peer: socket write error]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.rollbackConnection(JobStoreSupport.java:2319)
at org.quartz.impl.jdbcjobstore.JobStoreTX.acquireNextTrigger(JobStoreTX.java:1222)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:233)
* Nested Exception (Underlying Cause) ---------------
java.sql.SQLException: Io 异常: Connection reset by peer: socket write error
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
at oracle.jdbc.driver.OracleConnection.rollback(OracleConnection.java:1380)
at org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:328)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.rollback(PoolingDataSource.java:312)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.rollbackConnection(JobStoreSupport.java:2317)
at org.quartz.impl.jdbcjobstore.JobStoreTX.acquireNextTrigger(JobStoreTX.java:1222)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:233)
2009-03-06 09:38:46 [org.quartz.impl.jdbcjobstore.JobStoreTX]-[ERROR] MisfireHandler: Error handling misfires: Couldn't rollback jdbc connection. Io 异常: Connection reset by peer: socket write error
org.quartz.JobPersistenceException: Couldn't rollback jdbc connection. Io 异常: Connection reset by peer: socket write error [See nested exception: java.sql.SQLException: Io 异常: Connection reset by peer: socket write error]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.rollbackConnection(JobStoreSupport.java:2319)
at org.quartz.impl.jdbcjobstore.JobStoreTX.doRecoverMisfires(JobStoreTX.java:1361)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:2449)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:2468)
* Nested Exception (Underlying Cause) ---------------
java.sql.SQLException: Io 异常: Connection reset by peer: socket write error
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
at oracle.jdbc.driver.OracleConnection.rollback(OracleConnection.java:1380)
at org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:328)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.rollback(PoolingDataSource.java:312)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.rollbackConnection(JobStoreSupport.java:2317)
at org.quartz.impl.jdbcjobstore.JobStoreTX.doRecoverMisfires(JobStoreTX.java:1361)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:2449)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:2468)

解决方法:

We searched google on the error and found the solution of overriding the getObjectFromBlob(ResultSet rs, String colName) method of

org.quartz.impl.jdbcjobstore.MSSQLDelegate class which is used in DotJobStore.java.

We implemented the solution as follows:
1.Coded a new class by name org.quartz.impl.jdbcjobstore.DotMSSQLDelegate.java which extends org.quartz.impl.jdbcjobstore.MSSQLDelegate

2.overridden the method getObjectFromBlob(ResultSet rs, String colName) which has below code:

      InputStream binaryInput = rs.getBinaryStream(colName);
if (binaryInput == null || binaryInput.available()== 0)
{
return null;
}
Object obj = null;
ObjectInputStream in =null;
try
{
in= new ObjectInputStream(binaryInput);
obj = in.readObject();
}catch(Exception e){
e.printStackTrace();
}
finally
{
if(in!=null)
in.close();
}

return obj;

3.We tested and it is working fine.

If it is ok for you We want to commit the code.

Are we moving in the right direction?

http://www.javauu.com/thread-16-1-1.html

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值