栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

jmeter压测,接口返回:org.springframework.dao.RecoverableDataAccessException

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

jmeter压测,接口返回:org.springframework.dao.RecoverableDataAccessException

错误日志:

{"timestamp":1659058978622,"status":500,"error":"Internal Server Error","exception":"org.springframework.dao.RecoverableDataAccessException","message":"n### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 48,911,413 milliseconds ago.  The last packet sent successfully to the server was 48,911,427 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.n### The error may exist in com/iflytek/sclass/learnenglish/mapper/EnglishDailyDicMapper.java (best guess)n### The error may involve com.iflytek.sclass.learnenglish.mapper.EnglishDailyDicMapper.selectByPhaseAndTime-Inlinen### The error occurred while setting parametersn### SQL: select a.id, a.phase_type, a.create_time , b.content, b.chinese, b.audio_url FROM english_daily_dic a LEFT JOIN english_sentence_list b ON a.sentence_id = b.id WHERe a.phase_type = ? AND a.create_time = ? limit 1n### Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 48,911,413 milliseconds ago.  The last packet sent successfully to the server was 48,911,427 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.n; SQL []; The last packet successfully received from the server was 48,911,413 milliseconds ago.  The last packet sent successfully to the server was 48,911,427 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either

mysql默认如果8小时没有请求的话就会断开链接。
方法一:
通过在MYSQL的JDBC连接串上加了autoReconnectForPools=true即可解决。

方法二:
通过在配置文件中dhcp部分加上如下两个参数,然后重启服务解决
testOnBorrow=”true”
validationQuery=”select 1″
方法三:
上述方法只对mysql5以前的版本生效,所以mysql5以后用下述方法

mysql﹥
  mysql﹥ show global variables like ‘wait_timeout’;

±--------------±--------+

| Variable_name | Value |

±--------------±--------+

| wait_timeout | 28800 |

±--------------±--------+

1 row in set (0.00 sec)

28800 seconds,也就是8小时。

查看mysql5的手册,发现对wait_timeout的最大值分别是24天/365天(windows/linux)。以windows为例,假设我们要将其设为21天,我们只要修改mysql5的配置文件“my.ini”(mysql5 installation dir),增加一行:wait_timeout=1814400

需要重新启动mysql5。

linux系统配置文件:/etc/my.cnf

测试显示问题解决了。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1032607.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号