druid连接超过15分钟
@wenshao 你好,想跟你请教个问题:
老师您好:
在用druid(1.1.5版本)作为impala的连接池过程中,发现连接长时间不用,等再次获取连接时校验连接是否有效花费了15分钟。请问老师是否有什么解决方案,希望得到您的回答,谢谢!
错误日志如下:
java.sql.SQLNonTransientConnectionException: [Simba][JDBC](10060) Connection has been closed.
at com.cloudera.exceptions.ExceptionConverter.toSQLException(Unknown Source)
at com.cloudera.jdbc.common.SConnection.closeConnection(Unknown Source)
at com.cloudera.jdbc.common.SConnection.abortInternal(Unknown Source)
at com.cloudera.jdbc.common.SConnection.close(Unknown Source)
at com.alibaba.druid.util.JdbcUtils.close(JdbcUtils.java:73)
at com.alibaba.druid.pool.DruidDataSource.discardConnection(DruidDataSource.java:1322)
at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1287)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1221)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1211)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:105)
at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sinolife.sf.trace.JdbcTracePlugin.openConnection(JdbcTracePlugin.java:174)
at com.sinolife.sf.framework.dbcontext.DbSessionContextPlugin$1.invoke(DbSessionContextPlugin.java:279)
at com.sun.proxy.$Proxy141.getConnection(Unknown Source)
at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:151)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:371)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:415)
at com.fd.offline.impala.service.Impl.ImpalaDBServiceImpl.refresh(ImpalaDBServiceImpl.java:49)
at com.fd.offline.service.impl.ImpalaServiceImpl.refresh(ImpalaServiceImpl.java:164)
at com.fd.offline.controller.ImpalaController.refresh(ImpalaController.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
at com.fd.common.aspect.WebLogAspect.doAround(WebLogAspect.java:59)
at sun.reflect.GeneratedMethodAccessor320.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at com.sinolife.sf.framework.controller.ControllerBrowserNoCacheMethodInterceptor.invoke(ControllerBrowserNoCacheMethodInterceptor.java:19)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
initial-size: 5
maxActive: 20
minIdle: 0
maxWait: 10000
validationQuery: SELECT 1
testOnBorrow: false
testOnReturn: false
testWhileIdle: true
timeBetweenEvictionRunsMillis: 6000
minEvictableIdleTimeMillis: 5000
removeAbandoned: true
removeAbandonedTimeout: 1800
logAbandoned: true
filters: mergeStat
这个是我的配置,你对比下看看, 我之前也是因为配置问题,遇到同样的情况
是的
参数配置,testWhileIdle: true,检查下