进到源码搜索这句「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相关推荐

  1. 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 ...

  2. druid报错 discard long time none received connection

    问题背景 在项目启动时出现大量 c.a.d.pool.DruidAbstractDataSource: discard long time none received connection. 明显是D ...

  3. SpringBoot+MyBatis启动报错java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal

    2019独角兽企业重金招聘Python工程师标准>>> 如题,在启动SpringBoot时报SpringBoot+MyBatis启动报错java.lang.NoClassDefFou ...

  4. SpringBoot项目启动报错:Field userMapper in com.demo.controller.MemberController required a bean of type ‘c

    问题描述: SpringBoot项目启动报错,报错内容:'com.xxx.mapper.XxxxMapper' that could not be found ******************** ...

  5. 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 ...

  6. idea软件 springboot项目启动报错:命令行太长解决

    idea软件 springboot项目启动报错:命令行太长解决 1.找到项目下得.idea文件夹,打开文件workspace.xml 2.搜索标签 <component name="P ...

  7. springboot项目启动报错-案例情景介绍

    文章目录 摘要 情况1:Nacos报错 情况2:IllegalStateException: Incompatible fallbackFactory instance 情况3:idea编译java文 ...

  8. xcode高版本常见的RN本地启动报错

    xcode编译报错:'config.h' file not found 解决方案 cd node_modules/react-native/third-party/glog-0.3.4 ../../s ...

  9. 【图文详解】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 ...

最新文章

  1. JDK/Dubbo/Spring 三种 SPI 机制,谁更好?
  2. poj2352(树状数组)
  3. 系统架构师-基础到企业应用架构-企业应用架构
  4. Linux信号 二 信号处理函数注册
  5. QT的QQmlComponent类的使用
  6. C#生成二维码(含解码)
  7. 网吧java安装路径,java环境变量配置
  8. win7系统电脑d盘不见了的解决方法
  9. Soul递交IPO招股书:腾讯为第一大股东,依然处于亏损状态
  10. PHPEXCEL 不能输出中文内容,只显示空白
  11. 2006年博客之星(小废物点评版)
  12. [转载]你是那个能和我同行一生的人吗?
  13. jfinal-mailer一款支持线程池的异步邮件,可以使用freemarker作为模板的邮件插件...
  14. 【语音增强】基于matlab GUI维纳滤波语音增强【含Matlab源码 298期】
  15. 戒指的戴法,终于收齐了!
  16. Local Linear Model, Semi Local Linear Model and Local Level Model of TFP.STS
  17. 盘点互联网招聘玩法:从垂直招聘到猎头平台到精准匹配
  18. java 405_Http状态405-方法不允许
  19. SEO的心灵窗户:软文技巧
  20. 重装系统服务器不识别u盘,重装系统时BIOS不识别U盘启动盘如何解决?

热门文章

  1. 1527. 患某种疾病的患者
  2. Excel工作表忘记密码后取消密码
  3. 《ZigBee实战演练》
  4. 车联网用到了哪些关键技术,未来的趋势是什么
  5. 电赛 | 循迹小车(省电赛一等奖作品)
  6. 如何用 Photoshop 做出这种迷幻效果?
  7. HNUCM-XP的点滴(水题)
  8. 用汇编程序实现电子时钟
  9. HUD1.2.4 Nasty Hacks
  10. Java编写网络打字游戏