java.util.NoSuchElementException: Timeout waiting for idle object

严重: Servlet.service() for servlet springMvc threw exception
java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1174)
at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
at org.hibernate.loader.Loader.doQuery(Loader.java:801)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2542)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at com.wa.dataprocess.credit.topic.dao.impl.CountryTaxArrearsImpl.findList(CountryTaxArrearsImpl.java:74)
at com.wa.dataprocess.credit.topic.service.CountryTaxArrearsService.findList(CountryTaxArrearsService.java:24)
at com.wa.dataprocess.credit.topic.controller.CountryTaxArrearsController.findCountryArrears(CountryTaxArrearsController.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.wa.dataprocess.xyxgxx.filter.LogFilter.doFilter(LogFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1774)

at java.lang.Thread.run(Thread.java:619)

网页中的错误:

HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException:Cannot open connection


type Exception report

message Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection

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

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
	com.wa.dataprocess.xyxgxx.filter.LogFilter.doFilter(LogFilter.java:83)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

root cause

org.hibernate.exception.GenericJDBCException: Cannot open connection
	org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
	org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
	org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
	org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
	org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
	org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
	org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
	org.hibernate.loader.Loader.doQuery(Loader.java:801)
	org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
	org.hibernate.loader.Loader.doList(Loader.java:2542)
	org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
	org.hibernate.loader.Loader.list(Loader.java:2271)
	org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459)
	org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365)
	org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
	org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
	org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
	org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:890)
	com.wa.dataprocess.credit.topic.dao.impl.CountryTaxArrearsImpl.findTotal(CountryTaxArrearsImpl.java:47)
	com.wa.dataprocess.credit.topic.service.CountryTaxArrearsService.findTotal(CountryTaxArrearsService.java:19)
	com.wa.dataprocess.credit.topic.controller.CountryTaxArrearsController.findCountryArrears(CountryTaxArrearsController.java:58)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:597)
	org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
	com.wa.dataprocess.xyxgxx.filter.LogFilter.doFilter(LogFilter.java:83)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

root cause

org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
	org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
	org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
	org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)
	org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
	org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
	org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
	org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
	org.hibernate.loader.Loader.doQuery(Loader.java:801)
	org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
	org.hibernate.loader.Loader.doList(Loader.java:2542)
	org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
	org.hibernate.loader.Loader.list(Loader.java:2271)
	org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459)
	org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365)
	org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
	org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
	org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
	org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:890)
	com.wa.dataprocess.credit.topic.dao.impl.CountryTaxArrearsImpl.findTotal(CountryTaxArrearsImpl.java:47)
	com.wa.dataprocess.credit.topic.service.CountryTaxArrearsService.findTotal(CountryTaxArrearsService.java:19)
	com.wa.dataprocess.credit.topic.controller.CountryTaxArrearsController.findCountryArrears(CountryTaxArrearsController.java:58)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:597)
	org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
	com.wa.dataprocess.xyxgxx.filter.LogFilter.doFilter(LogFilter.java:83)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

root cause

java.util.NoSuchElementException: Timeout waiting for idle object
	org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1174)
	org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
	org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
	org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
	org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)
	org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
	org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
	org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
	org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
	org.hibernate.loader.Loader.doQuery(Loader.java:801)
	org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
	org.hibernate.loader.Loader.doList(Loader.java:2542)
	org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
	org.hibernate.loader.Loader.list(Loader.java:2271)
	org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459)
	org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365)
	org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
	org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
	org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
	org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:890)
	com.wa.dataprocess.credit.topic.dao.impl.CountryTaxArrearsImpl.findTotal(CountryTaxArrearsImpl.java:47)
	com.wa.dataprocess.credit.topic.service.CountryTaxArrearsService.findTotal(CountryTaxArrearsService.java:19)
	com.wa.dataprocess.credit.topic.controller.CountryTaxArrearsController.findCountryArrears(CountryTaxArrearsController.java:58)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:597)
	org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
	com.wa.dataprocess.xyxgxx.filter.LogFilter.doFilter(LogFilter.java:83)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

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


只是简单的查询几条数据,一会可以查出来,刷新一下又正常了。就这样,反反复复....

以为是自己代码写的有问题,最后发现在数据库的连接池中设置的参数太小,修改大一点问题就可以解决了..

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值