Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 2,926,157 milliseconds ago. The last packet sent successfully to the server was 2,926,158 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.

解决办法:
如果连接闲置8小时 (8小时内没有进行数据库操作), mysql就会自动断开连接, 要重启tomcat.
不用hibernate的话, connection url加参数: autoReconnect=true
用hibernate的话, 加如下属性:

<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider
        </property>
        <property name="hibernate.c3p0.max_size">50</property>
        <property name="hibernate.c3p0.min_size">5</property>
        <property name="hibernate.c3p0.timeout">10</property>
        <property name="hibernate.c3p0.max_statements">50</property>
        <property name="hibernate.c3p0.idle_test_period">10</property>
        <property name="hibernate.c3p0.acquire_increment">2</property>

The last packet successfully received from the server was 2,926,157 milliseconds ago. The last packet sent successfully to the server was 2,926,158 milliseconds ago. is longer than the server configured value of 'wait_timeout'. 解决办法的更多相关文章

  1. mysql中连接失败2003错误解决办法

    在使用mysql数据库,新建连接时,会报2003-Can't connect to server on 'localhost'(10038)错误,原因主要是MYSQL服务没有启动起来,但是进入:计算机 ...

  2. 在项目中导入import javax.servlet 出错解决办法

    我们有时会把别人的项目copy到自己这里进行二次开发或者参考学习,有的时候会发生下图的错误,即eclipse项目里我们导入的项目里提示HttpServletRequest 不能引用,会伴随头疼的小红叉 ...

  3. The last packet successfully received from the server was 20,519 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

    本地升级了下MySQL的版本,从5.6升为5.7,数据文件直接拷贝的,项目查询数据库报错: Could not retrieve transation read-only status server ...

  4. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 78,050,512 milliseconds ago.

    今天访问已经架上服务器的网站,报错: Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet s ...

  5. Mysql 的异常:The last packet successfully received from the server was 90 milliseconds ago. The last packet sent successfully to the server was 43,603,303 milliseconds ago. is longer than the server con

    调试一个程序, 调试到一半, 下班回家, 程序卡在了某一行, 第二天早上回来一看, 发现了异常: Wed Sep :: GMT+: WARN: Establishing SSL connection ...

  6. The last packet successfully received from the server was 1,480 milliseconds ago.

    场景:一个上传接口,需要上传几十M的文件,文件中包含10几W的数据,然后对10+W的数据进行同步批量插入,每次批量插入1W.最后返回结果. 项目上线一段时间后,上传接口出现问题,数据库用的MySQL5 ...

  7. 【异常】ser class threw exception: java.sql.SQLException: The last packet successfully received from the server was 39,444 milliseconds ago. The last

    1 详细异常 ser class threw exception: java.sql.SQLException: The last packet successfully received from ...

  8. Communications link failure,The last packet successfully received from the server was *** millisecon

    使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误: Communications link failure,The last packet successfully r ...

  9. ambari-server启动报错500 status code received on GET method for API:/api/v1/stacks/HDP/versions/2.4/recommendations Error message : Server Error解决办法(图文详解)

    问题详情 来源是,我在Ambari集群里,安装Hue. 给Ambari集群里安装可视化分析利器工具Hue步骤(图文详解 所遇到的这个问题. 然后,去ambari-server的log日志,查看,如下 ...

随机推荐

  1. getElementsByClassName 兼容性

    getElementsByClassName是html5 新增加的一个类名.该方法可以让我们通过class属性中的类名来访问元素.不过该方法比较新,某些DOM树还没有,因此在使用中要当心.由于只有较新 ...

  2. EJB的调用

    EJB调用.html :first-child{margin-top:0!important}img.plugin{box-shadow:0 1px 3px rgba(0,0,0,.1);border ...

  3. css精灵

    ○ css 精灵(Sprites)技术利用photoshop将图片整合,然后用background-images,background-position,background-repeat技术,对图片 ...

  4. laravel 实现上传 excel

    //导入电话号码 public function postTel(){ set_time_limit(0); ini_set('memory_limit','1024M'); $params = In ...

  5. 优秀开发人员网站推荐。——Arvin

    常用论坛汇总:智能车制作论坛:http://www.znczz.com/中国电子网:http://www.21ic.com/爱板网:http://www.eeboard.com/电子发烧友:http: ...

  6. 后缀数组(suffix array)

    参考: Suffix array - Wiki 后缀数组(suffix array)详解 6.3   Suffix Arrays - 算法红宝书 Suffix Array 后缀数组 基本概念 应用:字 ...

  7. MongoDB 备份(mongodump)与恢复(mongorestore)

    MongoDB数据备份 在Mongodb中我们使用mongodump命令来备份MongoDB数据.该命令可以导出所有数据到指定目录中. mongodump命令可以通过参数指定导出的数据量级转存的服务器 ...

  8. 无法启动xwindow

    1 新建一个lqx用户,执行startx命令出现: Fatal server error: PAM authentication failed, cannot start X server. perh ...

  9. kafka 搭建与使用

    消息量非超级多不建议使用,可以使用redis或Beanstalkd 使用简单 Beanstalkd 客户端建议用:composer require pda/pheanstalk 如果无JAVA JDK ...

  10. SharePoint Foundation 2013 安装出错

    前段时间装foundation 13的时候遇到这个问题.怀疑是Office的问题.然后找了一些资料,问题得到了解决 解决方案: 运行 regedit,删除注册表下的office的LicenseType ...