5
我使用這個配置一個Grails 2.2.3應用程序連接到MySQL數據庫:Grails的2.3.0和MySQL連接超時
production {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop','update'
url = "jdbc:mysql://localhost/database?autoReconnect=true"
pooled = true
properties {
maxActive = 50
maxIdle = 25
minIdle = 5
initialSize = 5
minEvictableIdleTimeMillis = 1800000
timeBetweenEvictionRunsMillis = 1800000
maxWait = 10000
}
}
}
升級到Grails的2.3.0這個停止工作後和週末在應用程序處於非活動狀態我得到以下例外:
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 50,139,380 milliseconds ago. The last packet sent successfully to the server was 50,139,380 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.
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3352)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1971)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2619)
at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4997)
... 5 more
Caused by: java.net.SocketException: Write failed: Broken pipe
at jrockit.net.SocketNativeIO.socketWrite(SocketNativeIO.java:46)
任何想法?
的Grails 2.3.1工作已經被釋放,所以你可能會考慮更新到第一位。 – str
我試過了,但是我在2.3.1上也得到了同樣的錯誤... – Luca
你看過這張票嗎: http://stackoverflow.com/questions/18078777/tomcat-7-0-42-pooling -hibernate-4-2-mysql-rock-solid-autoreconnect-solution 它可以幫助你! –