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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题