tomcat项目运行一段时间后无法连接sql server2008数据库,重启tomat又好了

具体报错:
org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object

The error may exist in /com/dayainfo/ssp/sqlMapper/sqlMapper-basicDataExpertSearch.xml

The error may involve .selectBasicDataExpertSearchByKey

The error occurred while executing a query

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object] with root cause

java.util.NoSuchElementException: Timeout waiting for idle object

tomcat版本:是tomcat7
sql server版本:sql server 2008 R2
tomcat和sql server不在同一个服务器

你数据库运行时间有问题
你可以查查 也有可能是你写的代码有问题