KING840520 2011-07-08 10:40
浏览 292
已采纳

请问用spring+ibatis时,tomcat服务器一直启动着,但是如果长时间不访问网页,相隔估计8个小时以上,再访问网页

请问用spring+ibatis时,tomcat服务器一直启动着,但是如果长时间不访问网页,相隔估计8个小时以上,再访问网页时,就会报出下面的错误,在刷新网页就可以访问了,请问为什么????

[code="java"]HTTP Status 500 -


type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.springframework.dao.DataAccessResourceFailureException: SqlMapClient operation; SQL [];

--- The error occurred in com/wanmei/wa/dao/ibatis/ibatis-wangbz.xml.

--- The error occurred while applying a parameter map.

--- Check the ibatis-wangbz.getUser-InlineParameterMap.

--- Check the statement (query failed).

--- Cause: java.sql.SQLException: Io 异常: Connection reset; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:

--- The error occurred in com/wanmei/wa/dao/ibatis/ibatis-wangbz.xml.

--- The error occurred while applying a parameter map.

--- Check the ibatis-wangbz.getUser-InlineParameterMap.

--- Check the statement (query failed).

--- Cause: java.sql.SQLException: Io 异常: Connection reset
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:253)
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203)
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:293)
com.wanmei.wa.dao.ibatis.IbatisDao.queryForList(IbatisDao.java:37)
com.wanmei.wa.business.impl.LoginBusinessImpl.getSessionUser(LoginBusinessImpl.java:44)
com.wanmei.wa.util.LoginFilter.doLogin(LoginFilter.java:80)
com.wanmei.wa.util.LoginFilter.doFilter(LoginFilter.java:63)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)

root cause

com.ibatis.common.jdbc.exception.NestedSQLException:

--- The error occurred in com/wanmei/wa/dao/ibatis/ibatis-wangbz.xml.

--- The error occurred while applying a parameter map.

--- Check the ibatis-wangbz.getUser-InlineParameterMap.

--- Check the statement (query failed).

--- Cause: java.sql.SQLException: Io 异常: Connection reset
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:295)
org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:1)
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:200)
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:293)
com.wanmei.wa.dao.ibatis.IbatisDao.queryForList(IbatisDao.java:37)
com.wanmei.wa.business.impl.LoginBusinessImpl.getSessionUser(LoginBusinessImpl.java:44)
com.wanmei.wa.util.LoginFilter.doLogin(LoginFilter.java:80)
com.wanmei.wa.util.LoginFilter.doFilter(LoginFilter.java:63)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)

root cause

java.sql.SQLException: Io 异常: Connection reset
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:274)
oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:432)
oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:896)
oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986)
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:2979)
com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.execute(NewProxyPreparedStatement.java:989)
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:185)
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:295)
org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:1)
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:200)
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:293)
com.wanmei.wa.dao.ibatis.IbatisDao.queryForList(IbatisDao.java:37)
com.wanmei.wa.business.impl.LoginBusinessImpl.getSessionUser(LoginBusinessImpl.java:44)
com.wanmei.wa.util.LoginFilter.doLogin(LoginFilter.java:80)
com.wanmei.wa.util.LoginFilter.doFilter(LoginFilter.java:63)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.


Apache Tomcat/6.0.26[/code]

附上datasource.properties
[code="java"]########################################

c3p0 Basic Pool Configuration

########################################

Determines how many connections at a time c3p0 will try to acquire when the pool

is exhausted. Default: 3

c3p0.acquireIncrement=3

Number of Connections a pool will try to acquire upon startup. Should be between

minPoolSize and maxPoolSize. Default: 3

c3p0.initialPoolSize=4

Maximum number of Connections a pool will maintain at any given time. Default: 15

c3p0.maxPoolSize=64

Minimum number of Connections a pool will maintain at any given time. Default: 3

c3p0.minPoolSize=4

Seconds a Connection can remain pooled but unused before being discarded.

Zero means idle connections never expire. Default: 0

c3p0.maxIdleTime=25200

Number of seconds that Connections in excess of minPoolSize should be permitted to remain

idle in the pool before being culled. If maxIdleTime is set, maxIdleTimeExcessConnections

should be smaller if the parameter is to have any effect. Default: 0

c3p0.maxIdleTimeExcessConnections=1800

The number of milliseconds a client calling getConnection() will wait for a Connection

to be checked-in or acquired when the pool is exhausted.

c3p0.checkoutTimeout=6000

c3p0.idleConnectionTestPeriod=18000

c3p0.preferredTestQuery='select 1 from daul'[/code]

  • 写回答

4条回答

  • iteye_8658 2011-07-08 18:25
    关注

    不清楚oracle有没有这个8小时的问题,不过我相信应该也有。要不然connection pool里的有些connection可能就永远无法释放。mysql是8小时不活动的connection就会由数据库端释放,而在这时pool并不知道这个情况,这时再试图去使用这个connection,就会出现你说的那种问题。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python