springboot本地启动报错discard long time none received connection
进到源码搜索这句「discard long time none received connection.」报错,在「com.alibaba.druid.pool.DruidAbstractDataSource#testConnectionInternal(com.alibaba.druid.pool.DruidConnectionHolder, java.sql.Connection)」找到如下代码:if (valid && isMySql) { // unexcepted branchlong lastPacketReceivedTimeMs = MySqlUtils.getLastPacketReceivedTimeMs(conn);if (lastPacketReceivedTimeMs > 0) {long mysqlIdleMillis = currentTimeMillis - lastPacketReceivedTimeMs;if (lastPacketReceivedTimeMs > 0 //&& mysqlIdleMillis >= timeBetweenEvictionRunsMillis) {discardConnection(holder);String errorMsg = "discard long time none received connection. "+ ", jdbcUrl : " + jdbcUrl+ ", version : " + VERSION.getVersionNumber()+ ", lastPacketReceivedIdleMillis : " + mysqlIdleMillis;LOG.warn(errorMsg);return false;}} } ----------------------------------- 我来解释一下,MySqlUtils.getLastPacketReceivedTimeMs(conn) 是获取上一次使用的时间,mysqlIdleMillis 就是计算出来空闲的时间,timeBetweenEvictionRunsMillis 是个写死的值 60秒,if (lastPacketReceivedTimeMs > 0 && mysqlIdleMillis >= timeBetweenEvictionRunsMillis) 就是如果连接空闲了 60秒以上,那就 discardConnection(holder) 丢弃这个旧连接并顺带打印了一个日志 LOG.warn(errorMsg)。 ----------------------------------- 【转】Alibaba 的 druid 报错 discard long time none received connection. 问题 https://blog.51cto.com/u_15101595/2625323 错误的原因是druid池子初始化的 在项目的Application添加下面注解即可:
static {System.setProperty("druid.mysql.usePingMethod", "false"); }
springboot本地启动报错discard long time none received connection相关推荐
- springboot报错discard long time none received connection. 的解决方法
原错误如下: 2022-10-07 20:13:20.839 ERROR 25784 --- [nio-2312-exec-6] c.a.druid.pool.DruidAbstractDataSou ...
- druid报错 discard long time none received connection
问题背景 在项目启动时出现大量 c.a.d.pool.DruidAbstractDataSource: discard long time none received connection. 明显是D ...
- SpringBoot+MyBatis启动报错java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
2019独角兽企业重金招聘Python工程师标准>>> 如题,在启动SpringBoot时报SpringBoot+MyBatis启动报错java.lang.NoClassDefFou ...
- SpringBoot项目启动报错:Field userMapper in com.demo.controller.MemberController required a bean of type ‘c
问题描述: SpringBoot项目启动报错,报错内容:'com.xxx.mapper.XxxxMapper' that could not be found ******************** ...
- SpringBoot项目启动 报错:Error executing Maven. end tag name </settings> must match start tag name
SpringBoot项目启动 报错:Error executing Maven. end tag name must match start tag name from line xxx 第一次创建s ...
- idea软件 springboot项目启动报错:命令行太长解决
idea软件 springboot项目启动报错:命令行太长解决 1.找到项目下得.idea文件夹,打开文件workspace.xml 2.搜索标签 <component name="P ...
- springboot项目启动报错-案例情景介绍
文章目录 摘要 情况1:Nacos报错 情况2:IllegalStateException: Incompatible fallbackFactory instance 情况3:idea编译java文 ...
- xcode高版本常见的RN本地启动报错
xcode编译报错:'config.h' file not found 解决方案 cd node_modules/react-native/third-party/glog-0.3.4 ../../s ...
- 【图文详解】SpringBoot项目启动报错:The bean ‘xxxServiceImpl‘ could not be injected as a ‘xxxServiceImpl‘ ...
问题描述: 项目启动报错:The bean 'xxxServiceImpl' could not be injected as a 'cn.xxxx.service.xxxServiceImpl' b ...
最新文章
- JDK/Dubbo/Spring 三种 SPI 机制,谁更好?
- poj2352(树状数组)
- 系统架构师-基础到企业应用架构-企业应用架构
- Linux信号 二 信号处理函数注册
- QT的QQmlComponent类的使用
- C#生成二维码(含解码)
- 网吧java安装路径,java环境变量配置
- win7系统电脑d盘不见了的解决方法
- Soul递交IPO招股书:腾讯为第一大股东,依然处于亏损状态
- PHPEXCEL 不能输出中文内容,只显示空白
- 2006年博客之星(小废物点评版)
- [转载]你是那个能和我同行一生的人吗?
- jfinal-mailer一款支持线程池的异步邮件,可以使用freemarker作为模板的邮件插件...
- 【语音增强】基于matlab GUI维纳滤波语音增强【含Matlab源码 298期】
- 戒指的戴法,终于收齐了!
- Local Linear Model, Semi Local Linear Model and Local Level Model of TFP.STS
- 盘点互联网招聘玩法:从垂直招聘到猎头平台到精准匹配
- java 405_Http状态405-方法不允许
- SEO的心灵窗户:软文技巧
- 重装系统服务器不识别u盘,重装系统时BIOS不识别U盘启动盘如何解决?