java – 如何克服org.springframework.dao.RecoverableDataAcces
发布时间:2020-12-15 02:19:08 所属栏目:Java 来源:网络整理
导读:将 Spring项目连接到 MySQL服务器时,我一直收到连接问题.我尝试过在网上找到的各种技巧,但无济于事.为了摆脱这种困境,我需要帮助.我正在下面放置我的Spring设置和堆栈跟踪. 弹簧设置 spring.datasource.tomcat.initialize=truespring.dataSource.tomcat.url=
将
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,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,or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. 解决方法
我一直有同样的问题.我认为我们要打开的配置设置是:
testWhileIdle 这是相关的tomcat connection pool docs 直到明天我才知道这是否对我有用. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- java – 当有更多数据时,Jasper报告以PDF格式导出空数据
- Java 9中是否提供了Ahead-of-Time编译?
- java – 如何启用@Required?
- 经典多线程问题-轮流打印字母和数字
- 需要GSON来返回Java JSONArray
- 我们真的需要在java RMI中创建Stub吗?
- java – 在eclipse中放置属性文件的位置以及如何在本地和服
- java – 具有Mockito.when()和泛型类型推断的奇怪的泛型边缘
- java – OkHttpClient在更新Retrofit到Retrofit 2之后坏了
- Java——二叉树/平衡二叉树/红黑树/B Trees/B+ Trees