请问用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]