2017-04-21 19 views
4

私のSpringプロジェクトをMySQLサーバーに接続するときに接続の問題を受けています。私はオンラインで見つけたが役に立たないさまざまなトリックを試した。私はこの困惑から逃れるために助けが必要です。私は下に私の春の設定とスタックトレースを配置しています。org.springframework.dao.RecoverableDataAccessExceptionを克服するには?

春セッティング

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

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. 

答えて

0

私は同じ問題を抱えてきました。私たちはオンにする構成設定があると思う:私は知らないだろう

testWhileIdle 

はここで関連 tomcat connection pool docs

だ明日までかどうか、これは私のために働きました。

+0

はい、それは私のために働いた。 –

関連する問題