java – 如何克服org.springframework.dao.RecoverableDataAccessException?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java – 如何克服org.springframework.dao.RecoverableDataAccessException?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1966字,纯文字阅读大概需要3分钟。
内容图文
![java – 如何克服org.springframework.dao.RecoverableDataAccessException?](/upload/InfoBanner/zyjiaocheng/767/9678676d54d8489d9319d0842e062813.jpg)
将Spring项目连接到MySQL服务器时,我一直收到连接问题.我尝试过在网上找到的各种技巧,但无济于事.为了摆脱这种困境,我需要帮助.我正在下面放置我的Spring设置和堆栈跟踪.
弹簧设置
spring.datasource.tomcat.initialize=true
spring.dataSource.tomcat.url=jdbc:mysql://nope/canttellyou?
autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull
spring.dataSource.tomcat.username=nope
spring.dataSource.tomcat.password=sorry
spring.dataSource.tomcat.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.tomcat.test-on-borrow=true
spring.datasource.tomcat.validation-query=SELECT 1
spring.datasource.tomcat.log-validation-errors=true
堆栈跟踪
stackTrace: org.springframework.dao.RecoverableDataAccessException:
PreparedStatementCallback; SQL [select catname from animals]; The last
packet successfully received from the server was 52,962,310
milliseconds ago. The last packet sent successfully to the server was
52,962,310 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.; nested
exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
The last packet successfully received from the server was 52,962,310
milliseconds ago. The last packet sent successfully to the server was
52,962,310 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.
解决方法:
我一直有同样的问题.我认为我们要打开的配置设置是:
testWhileIdle
这是相关的tomcat connection pool docs
直到明天我才知道这是否对我有用.
内容总结
以上是互联网集市为您收集整理的java – 如何克服org.springframework.dao.RecoverableDataAccessException?全部内容,希望文章能够帮你解决java – 如何克服org.springframework.dao.RecoverableDataAccessException?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。