Wenn meine Spring Boot App im Leerlauf ist länger, dass die MySql wait_timeout
schafft es nicht, eine neue Verbindung zu erstellen und die Anwendung ist unbrauchbar.Spring Boot Wont Recover Mysql Verbindung
2017-01-10 21:51:42.613 ERROR 26973 --- [http-nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : No operations allowed after connection closed.
2017-01-10 21:51:42.621 ERROR 26973 --- [http-nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: could not prepare statement; nested exception is org.hibernate.exception.JDBCConnectionException: could not prepare statement] with root cause
java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost
Ich habe durch viele ähnliche Problematik und die meisten Empfehlungen hinzugefügt, aber das Problem weiterhin besteht. Ich habe Dutzende von Kombinationen der folgenden Zeilen ausprobiert. Die relevanten Teile meines application.properties sind
spring.datasource.url = jdbc:mysql://localhost/mydb?autoReconnect=true&useSSL=false
spring.datasource.log-validation-errors=true
spring.datasource.tomcat.testOnBorrow=true
spring.datasource.tomcat.timeBetweenEvictionRunsMillis=30000
spring.datasource.tomcat.minEvictableIdleTimeMillis=60000
spring.datasource.tomcat.validationInterval=60000
spring.datasource.tomcat.validationQuery = SELECT 1
spring.datasource.tomcat.testWhileIdle=true
spring.datasource.tomcat.removeAbandoned=true
spring.datasource.tomcat.removeAbandonedTimeout=55
Ich habe auch die oben genannten Linien ohne den Kater Namespace versucht, aber ich glaube, dass .tomcat. ist korrekt für Spring Boot 1.4+. Ich habe auch Snake-Case-Eigenschaftsnamen versucht (z.B. test-while-idle).
Ich scheint wie die Config gerade ignoriert wird.
Ich verwende
- Frühlings-Boot 1.4.3
- Hibernate 5.2.6