登陆Opencms工作区:出现Communications link failure错误。

??????????SQL?????: Communications link failureThe last packet successfully received from the server was 33,537,195 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.??: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly los


org.opencms.db.CmsDbSqlException: An SQL error occurred when executing the following query: com.mysql.jdbc.JDBC4PreparedStatement@b38908: EXCEPTION: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed..
at org.opencms.db.generic.CmsVfsDriver.readResource(CmsVfsDriver.java:2327)

登陆Opencms工作区:出现Communications link failure错误。_第1张图片
 

 

 

原因:

      Mysql服务器默认的“wait_timeout”是8小时(也就是默认的值默认是28800秒),也就是说一个connection空闲超过8个小时,Mysql将自动断开该connection,通俗的讲就是一个连接在8小时内没有活动,就会自动断开该连接。而连接池却认为该连接还是有效的(因为并未校验连接的有效性),当应用申请使用该连接时,就会导致上面的报错。

      wait timeout的值可以设定,但最多只能是2147483,不能再大了。也就是约24.85天

 

 

 

解决办法:

        linux系统:编辑 /etc/mysql/my.cnf文件。


登陆Opencms工作区:出现Communications link failure错误。_第2张图片
 

wait_timeout=1814400
interactive_timeout=1814400

 

window系统:修改方法:找到MySQL目录下my.ini文件, 在

      # The TCP/IP Port the MySQL Server will listen on
      port=3306下面添加
      # this is myown dinifition for mysql connection timeout
      wait_timeout=181440

      interactive_timeout=181440 

你可能感兴趣的:(OpenCMS)