tomcat-druid 连接池溢出 getconnectiontimeoutexception

问题描述

druid 连接池溢出 getconnectiontimeoutexception

tomcat 异常显示:

严重: Servlet.service() for servlet springMvc threw exception
com.alibaba.druid.pool.GetConnectionTimeoutException: loopWaitCount 2, wait millis 60678
at com.alibaba.druid.pool.DruidDataSource.pollLast(DruidDataSource.java:1297)
at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:967)
at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:850)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4534)
at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:659)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4530)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:832)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:824)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:91)
at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141)
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292)
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214)
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157)
at org.hibernate.internal.SessionImpl.connection(SessionImpl.java:550)
at org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:428)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy46.login(Unknown Source)
at cn.bainaonline.bnerp.system.controller.UserController.login(UserController.java:100)
at sun.reflect.GeneratedMethodAccessor332.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)
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.doPost(FrameworkServlet.java:838)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
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.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)
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:1760)

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

Druid配置:

<!-- 配置数据源 -->
<bean name="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
    init-method="init" destroy-method="close">
    <property name="url" value="${jdbc_url}" />
    <property name="username" value="${jdbc_username}" />
    <property name="password" value="${jdbc_password}" />

    <!-- 初始化连接大小 -->
    <property name="initialSize" value="1" />
    <!-- 连接池最大使用连接数量 -->
    <property name="maxActive" value="20" />
    <!-- 连接池最小空闲 -->
    <property name="minIdle" value="1" />
    <!-- 获取连接最大等待时间 -->
    <property name="maxWait" value="60000" />

    <!-- <property name="poolPreparedStatements" value="true" /> <property
        name="maxPoolPreparedStatementPerConnectionSize" value="33" /> -->

    <property name="validationQuery" value="${validationQuery}" />
    <property name="testOnBorrow" value="false" />
    <property name="testOnReturn" value="false" />
    <property name="testWhileIdle" value="true" />

    <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
    <property name="timeBetweenEvictionRunsMillis" value="60000" />
    <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
    <property name="minEvictableIdleTimeMillis" value="25200000" />

    <!-- 打开removeAbandoned功能 -->
    <property name="removeAbandoned" value="true" />
    <!-- 1800秒,也就是30分钟 -->
    <property name="removeAbandonedTimeout" value="1800" />
    <!-- 关闭abanded连接时输出错误日志 -->
    <property name="logAbandoned" value="true" />

    <!-- 监控数据库 -->
    <!-- <property name="filters" value="mergeStat" /> -->
    <property name="filters" value="stat" />
</bean>

找了好久,没找到错误的地方。请各位大神解答。网上说是哪个地方conn连接没close。但是程序都是用hibernate 的getCurrentSession()获取事物的。

解决方案

请问楼主这个问题解决了吗?

解决方案二:

数据库连接获取超时,这么久远,大富翁怎么还给扒出来了呢?

时间: 2024-12-03 01:40:42

tomcat-druid 连接池溢出 getconnectiontimeoutexception的相关文章

druid 连接池溢出 getconnectiontimeoutexception

问题描述 tomcat异常显示:严重:Servlet.service()forservletspringMvcthrewexceptioncom.alibaba.druid.pool.GetConnectionTimeoutException:loopWaitCount2,waitmillis60678atcom.alibaba.druid.pool.DruidDataSource.pollLast(DruidDataSource.java:1297)atcom.alibaba.druid.po

mysql-使用druid连接池连接数据库,出现了以下问题,忘各位大神解答

问题描述 使用druid连接池连接数据库,出现了以下问题,忘各位大神解答 com.mysql.jdbc.exceptions.jorg.apache.ibatis.exceptions.PersistenceException: Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet se

spring+mybatis+c3p0数据库连接池或druid连接池使用配置整理

在系统性能优化的时候,或者说在进行代码开发的时候,多数人应该都知道一个很基本的原则,那就是保证功能正常良好的情况下,要尽量减少对数据库的操作. 据我所知,原因大概有这样两个: 一个是,一般情况下系统服务器和数据库服务器应该是不在同一硬件上,这时候对数据库的连接.操作就和网络有了很大的关系,连接.操作数据库越多就越影响性能. 二是,数据库的数据持久化在硬件磁盘上,对数据库数据的操作就要进行磁盘的io读写操作,同样是操作越多就越容易影响性能. 而数据库连接池的作用是负责分配.管理和释放数据库连接,它

druid连接池问题-今天试着搭建ssm框架遇到一个问题,用的druid连接池,这个druid报错了

问题描述 今天试着搭建ssm框架遇到一个问题,用的druid连接池,这个druid报错了 com.alibaba.druid.pool.vendor.MySqlValidConnectionChecker - Cannot resolve com.mysq.jdbc.Connection.ping method. Will use 'SELECT 1' instead. 解决方案 看错误好像是获取clazz实例时为null,暂时不能确认是不是mysql连接失败的问题.

mybatis批量插入oracle表(带自增量列) druid连接池报错修复

<insert id="saveBatch" parameterType="java.util.List">         insert into sys_slog(         id,         menu,         remote_addr,         request_uri,         method,         params,         user_agent,         exception,      

SpringMVC+Spring+Mybatis整合,使用druid连接池,声明式事务,maven配置

一直对springmvc和mybatis挺怀念的,最近想自己再搭建下框架,然后写点什么. 暂时没有整合缓存,druid也没有做ip地址的过滤.Spring的AOP简单配置了下,也还没具体弄,不知道能不能用,log也不知道能不能用,`(*∩_∩*)′哈哈,有点不负责任...... 2014-08-12 23:45补: =================开始================= 1.增加quartz :http://www.cnblogs.com/acehalo/p/3902731.h

Druid连接池简介和配置

Druid是什么?有什么作用?  Druid首先是一个数据库连接池,但它不仅仅是一个数据库连接池,它还包含一个ProxyDriver,一系列内置的JDBC组件库,一个SQL Parser. Druid的项目背景?目前的项目团队情况?开源目的?  2010年开始,我负责设计一个叫做Dragoon的监控系统,需要一些监控组件,监控应用程序的运行情况,包括Web URI.Spring.JDBC等.为了监控SQL执行情况,我做了一个Filter-Chain模式的ProxyDriver,缺省提供StatF

tomcat jdbc 连接池 参数说明

##############################MySQL数据库连接驱动############################## #数据库连接URL url=jdbc:mysql://localhost:3306/grtg?useUnicode=true&characterEncoding=utf8 #数据库连接驱动 driver=com.mysql.jdbc.Driver #数据库连接用户名 username=root #数据库连接密码 password=root ######

tomcat中连接池发生异常怎么解决?

问题描述 报的异常如下:org.apache.tomcat.dbcp.dbcp.SQLNestedException:Cannotgetaconnection,poolerrorTimeoutwaitingforidleobjectatorg.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)atorg.apache.tomcat.dbcp.dbcp.BasicDataSource