hibernate.exception.GenericJDBCException:无法打开连接

时间:2013-03-21 03:48:52

标签: hibernate exception generics jdbc transactions

当我尝试打开我的应用程序时,我多次收到此错误。请帮我理解这个堆栈跟踪。

请在此处找到堆栈跟踪:

[3/14/13 23:29:57:016 SGT] 00000029 WebAppE[Servlet Error]-[/acegi/authentication_target_dummy.jsp]: 

org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
                at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:596)
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
                at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:317)
                at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105)
                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
                at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
                at $Proxy32.auditAccess(Unknown Source)
                at com.actimize.infrastructure.access.AccessManager.auditAccess(AccessManager.java:58)
                at com.actimize.infrastructure.authentication.ACMAuthenticationProcessingFilter.auditLogin(ACMAuthenticationProcessingFilter.java:351)
                at com.actimize.infrastructure.authentication.ACMAuthenticationProcessingFilter.authenticateAndAudit(ACMAuthenticationProcessingFilter.java:316)
                at com.actimize.infrastructure.authentication.external.HeaderAuthenticationProcessingFilter.attemptAuthentication(HeaderAuthenticationProcessingFilter.java:97)
                at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:252)
                at com.actimize.infrastructure.authentication.ACMAuthenticationProcessingFilter.doFilter(ACMAuthenticationProcessingFilter.java:72)
                at com.actimize.infrastructure.authentication.external.HeaderAuthenticationProcessingFilter.doFilter(HeaderAuthenticationProcessingFilter.java:164)
                at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
                at com.actimize.infrastructure.authentication.external.ConfiguredHeaderProcessingFilter.doFilter(ConfiguredHeaderProcessingFilter.java:33)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)  
                at com.actimize.infrastructure.authentication.external.ConfiguredNtlmHttpFilter.doFilter(ConfiguredNtlmHttpFilter.java:156)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)  
                at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
                at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)  
                at com.actimize.infrastructure.http.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:66)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
                at com.actimize.infrastructure.http.RequestResponseFilter.doFilter(RequestResponseFilter.java:29)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190) 
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)  
                at com.actimize.infrastructure.cache.NoCacheFilter.doFilter(NoCacheFilter.java:44)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)  
                at com.actimize.infrastructure.perfmon.PerformanceMonitorHttpFilter.doFilter(PerformanceMonitorHttpFilter.java:26)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)  
                at com.actimize.infrastructure.encoding.MultilingualSupportFilter.doFilter(MultilingualSupportFilter.java:78)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)  
                at com.actimize.infrastructure.config.StartupErrorFilter.doFilter(StartupErrorFilter.java:32)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)  
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
                at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:848)
                at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:691)
                at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:654)
                at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:526)
                at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
                at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:248)
                at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
                at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:764) 
                at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
                at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:457)
                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:300)
                at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)  
                at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1830)
                at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
                at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
                at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
                at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
                at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
                at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
                at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
                at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1560)

Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
                at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
                at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
                at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
                at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
                at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
                at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
                at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
                at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
                at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)
                at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:555)
                ... 66 more

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
                at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
                at com.actimize.infrastructure.database.ActimizeDataSource.getConnection(ActimizeDataSource.java:60)
                at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
                at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
                ... 71 more

Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
                at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1134)
                at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
                ... 74 more

1 个答案:

答案 0 :(得分:0)

您正在使用Apache Commons DBCP进行连接池。您的auditAccess()方法需要事务,因此导致尝试获取数据库连接。池中的所有连接都忙,因此不可用,持续时间超过池上的maxWait setting,因此获取连接的尝试将失败并显示给定的堆栈跟踪。