1、Caused by: com.MySQL.jdbc.exceptions.jdbc4.CommunicationsException:
The last packet successfully received from the server was 56,201,339 milliseconds ago. The last packet sent successfully to the server was 56,201,339 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 sun.reflect.GeneratedConstructorAccessor257.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)at java.lang.reflect.Constructor.newInstance(Constructor.java:534)at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3291)at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1938)at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2107)at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2086)at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2237)at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)at org.hibernate.loader.Loader.doQuery(Loader.java:674)at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)at org.hibernate.loader.Loader.doList(Loader.java:2213)... 45 more解釋:
最后從服務器接收到數據包成功是56201339毫秒。最后一個數據包發送成功服務器56201339毫秒。長于服務器配置“wait_timeout”的價值。你應該考慮到期和/或有效性測試連接在應用程序中使用之前,增加服務器為客戶機超時配置值,或使用連接器/ J連接屬性“autoReconnect = true”來避免這個問題。
Linux 下/etc/mysql/mysql.cnf
mysql.cnf文件
#
# The MySQL database server configuration file.## You can copy this to one of:# - "/etc/mysql/my.cnf" to set global options,# - "~/.my.cnf" to set user-specific options.# # One can use all long options that the program supports.# Run program with --help to get a list of available options and with# --print-defaults to see which it would actually understand and use.## For explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html# This will be passed to all mysql clients# It has been reported that passwords should be enclosed with ticks/quotes# escpecially if they contain "#" chars...# Remember to edit /etc/mysql/debian.cnf when changing the socket location.[client]port = 3306socket = /var/run/mysqld/mysqld.sock新聞熱點
疑難解答
圖片精選