码迷,mamicode.com
首页 > 数据库 > 详细

今天线上系统碰到个怪问题DBCP数据连接异常,java.sql.SQLException: Already closed.

时间:2015-08-31 11:55:38      阅读:578      评论:0      收藏:0      [点我收藏+]

标签:异常   exception   dbcp   连接池   java   

java.sql.SQLException: Already closed.
at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:84) ~[commons-dbcp-1.2.2.jar:1.2.2]
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181) ~[commons-dbcp-1.2.2.jar:1.2.2]
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_45]
at org.tinygroup.dynamicdatasource.DynamicDataSource$ConnectionInvocationHandler.invoke(DynamicDataSource.java:227) ~[org.tinygroup.dynamicdatasource-2.0.0.jar:na]
at com.sun.proxy.$Proxy21.close(Unknown Source) ~[na:na]
at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:313) ~[spring-jdbc-2.5.6.jar:2.5.6]
at org.springframework.jdbc.datasource.DataSourceUtils.releaseConnection(DataSourceUtils.java:274) ~[spring-jdbc-2.5.6.jar:2.5.6]
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:237) [spring-jdbc-2.5.6.jar:2.5.6]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374) [spring-tx-2.5.6.jar:2.5.6]
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263) [spring-tx-2.5.6.jar:2.5.6]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101) [spring-tx-2.5.6.jar:2.5.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) [spring-aop-2.5.6.jar:2.5.6]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) [spring-aop-2.5.6.jar:2.5.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) [spring-aop-2.5.6.jar:2.5.6]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [spring-aop-2.5.6.jar:2.5.6]
at com.sun.proxy.$Proxy16.addCreditSerial(Unknown Source) [na:na]
at com.hsyr.cloud.p2p.loan.svr.credit.PLCreditService.addCreditSerialForUpdate(PLCreditService.java:323) [com.hsyr.cloud.p2p.loan.service-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.svr.credit.PLCreditService.updateCreditRemain(PLCreditService.java:291) [com.hsyr.cloud.p2p.loan.service-1.0.0-SNAPSHOT.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_45]
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) [org-exp-redis-1.0.0.jar:na]
at org.tinygroup.service.ServiceProxy.execute(ServiceProxy.java:150) [org.tinygroup.service-2.0.0.jar:na]
at org.tinygroup.service.impl.ServiceProviderImpl.execute(ServiceProviderImpl.java:85) [org.tinygroup.service-2.0.0.jar:na]
at org.tinygroup.serviceprocessor.ServiceEventProcessorImpl.process(ServiceEventProcessorImpl.java:47) [org.tinygroup.serviceprocessor-2.0.0.jar:na]
at org.tinygroup.cepcoreimpl.CEPCoreImpl.deal(CEPCoreImpl.java:279) [org.tinygroup.cepcoreimpl-2.0.0.jar:na]
at org.tinygroup.cepcoreimpl.CEPCoreImpl.process(CEPCoreImpl.java:224) [org.tinygroup.cepcoreimpl-2.0.0.jar:na]
at com.hsyr.cloud.p2p.loan.biz.util.PLProcessorServiceAction.callService(PLProcessorServiceAction.java:83) [com.hsyr.cloud.p2p.loan.biz-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.biz.util.PLProcessorServiceAction.retryInnerRequest(PLProcessorServiceAction.java:404) [com.hsyr.cloud.p2p.loan.biz-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.biz.util.PLProcessorServiceAction.performGetResult(PLProcessorServiceAction.java:393) [com.hsyr.cloud.p2p.loan.biz-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.biz.util.PLProcessorServiceAction.reallyProcess(PLProcessorServiceAction.java:185) [com.hsyr.cloud.p2p.loan.biz-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.ctl.PLTaskServiceAction.processTaskServiceAction(PLTaskServiceAction.java:57) [com.hsyr.cloud.p2p.loan.ctl-1.0.0-SNAPSHOT.jar:na]
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_45]
at org.tinygroup.commons.tools.ReflectionUtils.invokeMethod(ReflectionUtils.java:190) [org.tinygroup.commons-2.0.0.jar:na]
at org.tinygroup.weblayer.mvc.HandlerExecutionChain.execute(HandlerExecutionChain.java:133) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.mvc.impl.MappingModelExecuteImpl.execute(MappingModelExecuteImpl.java:40) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.tinyprocessor.MvcTinyProcessor.reallyProcess(MvcTinyProcessor.java:74) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.AbstractTinyProcessor.process(AbstractTinyProcessor.java:68) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.impl.TinyProcessorManagerImpl.execute(TinyProcessorManagerImpl.java:68) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.TinyFilterHandler.tinyFilterProcessor(TinyFilterHandler.java:107) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.impl.TinyFilterChain.doFilter(TinyFilterChain.java:62) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.filter.gzip.GZIPFilter.doFilter(GZIPFilter.java:75) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.impl.TinyFilterChain.doFilter(TinyFilterChain.java:59) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.impl.TinyFilterWrapper.filterWrapper(TinyFilterWrapper.java:79) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.TinyHttpFilter.doFilter(TinyHttpFilter.java:142) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1288) [jetty-servlet-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:443) [jetty-servlet-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:532) [jetty-security-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1044) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:372) [jetty-servlet-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:978) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.Server.handle(Server.java:369) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:486) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:933) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:995) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) [jetty-http-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) [jetty-http-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667) [jetty-io-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) [jetty-io-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) [jetty-util-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) [jetty-util-7.6.17.v20150415.jar:7.6.17.v20150415]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_45]
08:55:18.279 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean ‘exceptionHandlerManager‘
08:55:18.279 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean ‘exceptionHandlerManager‘
08:55:18.279 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean ‘org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0‘
08:55:18.279 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean ‘exceptionHandlerManager‘ to allow for resolving potential circular references
08:55:18.282 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean ‘org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0‘
08:55:18.282 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean ‘org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0‘
08:55:18.283 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean ‘exceptionHandlerManager‘
08:55:18.284 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean ‘exceptionHandlerManager‘
08:55:18.284 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean ‘exceptionHandlerManager‘
08:55:18.284 [qtp116331389-16] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean ‘exceptionHandlerManager‘
08:55:18.289 [qtp116331389-16] ERROR c.h.c.p.l.b.u.PLProcessorServiceAction - null
org.tinygroup.service.exception.ServiceRunException: null
at org.tinygroup.service.ServiceProxy.execute(ServiceProxy.java:166) ~[org.tinygroup.service-2.0.0.jar:na]
at org.tinygroup.service.impl.ServiceProviderImpl.execute(ServiceProviderImpl.java:85) ~[org.tinygroup.service-2.0.0.jar:na]
at org.tinygroup.serviceprocessor.ServiceEventProcessorImpl.process(ServiceEventProcessorImpl.java:47) ~[org.tinygroup.serviceprocessor-2.0.0.jar:na]
at org.tinygroup.cepcoreimpl.CEPCoreImpl.deal(CEPCoreImpl.java:279) ~[org.tinygroup.cepcoreimpl-2.0.0.jar:na]
at org.tinygroup.cepcoreimpl.CEPCoreImpl.process(CEPCoreImpl.java:224) ~[org.tinygroup.cepcoreimpl-2.0.0.jar:na]
at com.hsyr.cloud.p2p.loan.biz.util.PLProcessorServiceAction.callService(PLProcessorServiceAction.java:83) ~[com.hsyr.cloud.p2p.loan.biz-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.biz.util.PLProcessorServiceAction.retryInnerRequest(PLProcessorServiceAction.java:404) ~[com.hsyr.cloud.p2p.loan.biz-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.biz.util.PLProcessorServiceAction.performGetResult(PLProcessorServiceAction.java:393) ~[com.hsyr.cloud.p2p.loan.biz-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.biz.util.PLProcessorServiceAction.reallyProcess(PLProcessorServiceAction.java:185) ~[com.hsyr.cloud.p2p.loan.biz-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.ctl.PLTaskServiceAction.processTaskServiceAction(PLTaskServiceAction.java:57) [com.hsyr.cloud.p2p.loan.ctl-1.0.0-SNAPSHOT.jar:na]
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_45]
at org.tinygroup.commons.tools.ReflectionUtils.invokeMethod(ReflectionUtils.java:190) [org.tinygroup.commons-2.0.0.jar:na]
at org.tinygroup.weblayer.mvc.HandlerExecutionChain.execute(HandlerExecutionChain.java:133) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.mvc.impl.MappingModelExecuteImpl.execute(MappingModelExecuteImpl.java:40) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.tinyprocessor.MvcTinyProcessor.reallyProcess(MvcTinyProcessor.java:74) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.AbstractTinyProcessor.process(AbstractTinyProcessor.java:68) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.impl.TinyProcessorManagerImpl.execute(TinyProcessorManagerImpl.java:68) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.TinyFilterHandler.tinyFilterProcessor(TinyFilterHandler.java:107) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.impl.TinyFilterChain.doFilter(TinyFilterChain.java:62) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.filter.gzip.GZIPFilter.doFilter(GZIPFilter.java:75) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.impl.TinyFilterChain.doFilter(TinyFilterChain.java:59) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.impl.TinyFilterWrapper.filterWrapper(TinyFilterWrapper.java:79) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.tinygroup.weblayer.TinyHttpFilter.doFilter(TinyHttpFilter.java:142) [org.tinygroup.weblayer-2.0.0.jar:na]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1288) [jetty-servlet-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:443) [jetty-servlet-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:532) [jetty-security-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1044) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:372) [jetty-servlet-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:978) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.Server.handle(Server.java:369) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:486) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:933) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:995) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) [jetty-http-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) [jetty-http-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) [jetty-server-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667) [jetty-io-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) [jetty-io-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) [jetty-util-7.6.17.v20150415.jar:7.6.17.v20150415]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) [jetty-util-7.6.17.v20150415.jar:7.6.17.v20150415]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_45]
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_45]
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) ~[org-exp-redis-1.0.0.jar:na]
at org.tinygroup.service.ServiceProxy.execute(ServiceProxy.java:150) ~[org.tinygroup.service-2.0.0.jar:na]
... 49 common frames omitted
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:238) ~[spring-jdbc-2.5.6.jar:2.5.6]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374) ~[spring-tx-2.5.6.jar:2.5.6]
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263) ~[spring-tx-2.5.6.jar:2.5.6]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101) ~[spring-tx-2.5.6.jar:2.5.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) ~[spring-aop-2.5.6.jar:2.5.6]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) ~[spring-aop-2.5.6.jar:2.5.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) ~[spring-aop-2.5.6.jar:2.5.6]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) ~[spring-aop-2.5.6.jar:2.5.6]
at com.sun.proxy.$Proxy16.addCreditSerial(Unknown Source) ~[na:na]
at com.hsyr.cloud.p2p.loan.svr.credit.PLCreditService.addCreditSerialForUpdate(PLCreditService.java:323) ~[com.hsyr.cloud.p2p.loan.service-1.0.0-SNAPSHOT.jar:na]
at com.hsyr.cloud.p2p.loan.svr.credit.PLCreditService.updateCreditRemain(PLCreditService.java:291) ~[com.hsyr.cloud.p2p.loan.service-1.0.0-SNAPSHOT.jar:na]
... 55 common frames omitted
Caused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888) ~[mysql-connector-java-5.0.5.jar:na]
at com.mysql.jdbc.Connection.getMutex(Connection.java:3714) ~[mysql-connector-java-5.0.5.jar:na]
at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:5341) ~[mysql-connector-java-5.0.5.jar:na]
at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:331) ~[commons-dbcp-1.2.2.jar:1.2.2]
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:317) ~[commons-dbcp-1.2.2.jar:1.2.2]
at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_45]
at org.tinygroup.dynamicdatasource.DynamicDataSource$ConnectionInvocationHandler.invoke(DynamicDataSource.java:227) ~[org.tinygroup.dynamicdatasource-2.0.0.jar:na]
at com.sun.proxy.$Proxy21.setAutoCommit(Unknown Source) ~[na:na]
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:221) ~[spring-jdbc-2.5.6.jar:2.5.6]
... 65 common frames omitted


有一个参数说明一下:testOnBorrow true 指明是否在从池中取出连接前进行检验,如果检验失败,则从池中去除连接并尝试取出另一个. 


<property name="testOnBorrow"> 
    <value>trues</value> 
   </property> 

这个参数设为true时,还有一个参数的设置:validationQuery:SQL查询,用来验证从连接池取出的连接,在将连接返回给调用者之前.如果指定,则查询必须是一个SQL SELECT并且必须返回至少一行记录 

如果testOnBorrow为true而validationQuery没有设置,或为空,或你给的不是一个select语句且没有数据返回。testOnBorrow也是白设。validationQuery这个的SQL语句一般查询dual表.常用的有SELECT 1 FROM DUAL。最也不要使用SELECT sysdate FROM DUAL.这个语句的效率没有前面说的一个好。WebLogic 就是使用的SELECT 1 FROM DUAL这个sql语句。 

<property name="testOnBorrow"> 
    <value>true</value> 
   </property> 
   <property name="validationQuery"> 
    <value>SELECT 1 FROM DUAL</value> 
</property> 

要正式系统中使用的数据源最好是用上这个testOnBorrow。这样可以保证使用的每个数据源都不会出现长时间没有使用中断后。出现Could not close JDBC Connection这种问题。 

版权声明:本文为博主原创文章,未经博主允许不得转载。

今天线上系统碰到个怪问题DBCP数据连接异常,java.sql.SQLException: Already closed.

标签:异常   exception   dbcp   连接池   java   

原文地址:http://blog.csdn.net/zhanglu0223/article/details/48130705

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!