我的dB连接不断超时 . 我查看了人们为此提供的一些解决方案,并实施了它们,但到目前为止还没有任何结果 . 任何新想法,都会非常有帮助 .

Problem
对于webapp的一些请求,这是我得到的错误:

com.mysql.jdbc.CommunicationsException:从服务器成功收到的最后一个数据包是11,198,881毫秒 . 成功发送到服务器的最后一个数据包是11,198,881毫秒 . 比服务器配置的'wait_timeout'值长 . 您应该考虑在应用程序中使用之前过期和/或测试连接有效性,增加服务器配置的客户端超时值,或使用Connector / J连接属性“autoReconnect = true”来避免此问题 .

Solutions Tried

  • 测试连接有效性

  • 使用autoReconnect

Contents of context.xml

资源名称=“jdbc / dBConnectionMain”auth =“容器”type =“javax.sql.DataSource”maxActive =“20”maxIdle =“18”removeAbandoned =“true”removeAbandonedTimeout =“60”logAbandoned =“true”validationQuery = “select 1”testOnBorrow =“true”username =“user”password =“password”driverClassName =“com.mysql.jdbc.Driver”url =“jdbc:mysql:// localhost / databaseName?autoReconnect = true”/

有关于此的任何指示?

干杯,
RD