【Tomcat】tomcat报连接超时错误
程序一直报这个错误
[getui-server][ERROR] [2016-03-17 10:50:00] getui.task.HftMongoInfoTask.execute(137) | --HftMongoInfoTask-error-org.springframework.dao.RecoverableDataAccessException: PreparedStatementCallback; SQL [select mid from test_info where cid = 9]; Communications link failure The last packet successfully received from the server was 250,825 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 250,825 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
百度搜了很多,很多人都遇到过这个错误,大部分都是使用连接池方式时才会出现这个问题,短连接应该很难出现这个问题。这个问题的原因:
MySQL服务器默认的“wait_timeout”是28800秒即8小时,意味着如果一个连接的空闲时间超过8个小时,MySQL将自动断开该连接,而连接池却认为该连接还是有效的(因为并未校验连接的有效性),当应用申请使用该连接时,就会导致上面的报错。
1.按照错误的提示,可以在JDBC URL中使用autoReconnect属性,实际测试时使用了autoReconnect=true&failOverReadOnly=false,不过并未起作用,使用的是5.1版本,可能真像网上所说的只对4之前的版本有效。
2.没办法,只能修改MySQL的参数了,wait_timeout最大为31536000即1年,在my.cnf中加入:
[mysqld]
wait_timeout=31536000
interactive_timeout=31536000
3.以上方法试过了,都不行。
结果是我的连接池问题,dbcp链接数据库超时,增加一个自定检测释放,就可以了。
下面是两个我解决问题的链接,希望对遇到这个问题的伙伴有帮助。
【Tomcat】tomcat报连接超时错误的更多相关文章
- java连接redis5.0单机版报连接超时错误
使用java代码测试redis5.0单机版时,报redis连接超时异常,而linux上的redis能正常访问: redis.clients.jedis.exceptions.JedisConnecti ...
- idea启动,mysql连接超时错误
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received ...
- WebSphere中数据源连接池太小导致的连接超时错误记录
WebSphere中数据源连接池太小导致的连接超时错误记录. 应用连接超时错误信息: [// ::: CST] webapp E com.ibm.ws.webcontainer.webapp.WebA ...
- plsql通过instantclient连接oracle数据库报连接超时
配置:数据库oracle10.2;服务器操作系统centos5.5:客户机操作系统win7 32位:plsql版本10.0.5 配置前提必须关闭客户机与服务器操作系统的防火墙,否则会出现“连接超时”的 ...
- laravel 安装碰到的问题:全局安装 Laravel Installer,然后用下面的指令创建新项目: laravel new blog报连接超时解决方案
在执行laravel new project 的时候报错 cURL error 7: Failed to connect to cabinet.laravel.com port 80: Timed o ...
- FTP客户端遇到150连接超时错误的处理办法
环境:阿里云ECS,win server 2012 R2 / FTP Server(FileZilla 0.9.41) 问题描述:账号连接正常,但无法列出目录,提示150连接超时. 解决过程: 1.关 ...
- (转)Tomcat启动报Error listenerStart错误
今天启动Tomcat启动不了,报以下错: org.apache.catalina.core.StandardContext startInternalSEVERE: Error listenerSta ...
- Tomcat启动报Error listenerStart错误
http://xpenxpen.iteye.com/blog/1545648 今天启动Tomcat启动不了,报以下错: org.apache.catalina.core.StandardContext ...
- Tomcat启动报Error listenerStart错误 Context [] startup failed due to previous errors
本文转载自xpenxpen 今天启动Tomcat启动不了,报以下错: org.apache.catalina.core.StandardContext startInternal SEVERE: Er ...
随机推荐
- [WPF系列]- Style - Specify width/height as resource in WPF
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys=" ...
- php 获取当前服务器 系统
引子: 今天遇到一个问题,当执行文件操作是,不同系统之间的命令是不同的 , 所以需要判断当前系统. $is_win = strtoupper(substr(PHP_OS,0,3))==='WIN'?1 ...
- 嵌入式Linux驱动学习之路(十九)触摸屏驱动、tslib测试
触摸屏使用流程: 1. 按下产生中断. 2.在中断处理程序中启动AD转换XY坐标. 3.AD转换结束并产生AD中断. 4. 在AD的中断处理函数中上报信息,启动定时器. 5. 定时器时间到后进入中断, ...
- SQL语句的使用
SELECT b.level, a.cnt FROM (SELECT `level`,COUNT(*) AS cnt FROM wlsjlog GROUP BY level) a LEFT JOIN ...
- Python-18-Django 基础篇
1. Web 框架介绍 具体介绍Django之前,必须先介绍WEB框架等概念. Web框架:通俗地讲,就是别人已经设定好的一个web网站模板,你学习它的规则,然后「填空」或「修改」成你自己需要的样子. ...
- jquery select取值,赋值操作
select">jquery select取值,赋值操作 一.获取Select 获取select 选中的 text : $("#ddlRegType").find( ...
- ROS系统C++代码测试之gtest
1. 安装gtestsudo apt-get install libgtest-dev 2.修改CMakeLists.txtfind_package(GTest REQUIRED)uncommend ...
- vue2.0 开发实践总结之入门篇
vue2.0 据说也出了很久了,博主终于操了一次实刀. 整体项目采用 vue + vue-router + vuex (传说中的vue 全家桶 ),构建工具使用尤大大推出的vue-cli 后续文 ...
- 记一次排错,windows日志 模块 DLL C:\Windows\system32\inetsrv\aspnetcore.dll 未能加载。返回的数据为错误信息。
这个错误是在我本地开发环境,不是生产环境,如果是生产环境我就挂了....开发环境也痛苦啊,重装系统的话,我估计装系统+所有软件,少说也得1天..... 错误产生:重装IIS (尼玛,IIS总有一个小毛 ...
- table寻找兄弟列的值
function showCover(videoidtemp,curRow){ // curRow为当前元素.寻找当前元素的父元素,寻找父元素中class为tdd的元素..html() 是单元格td中 ...
http://elf8848.iteye.com/blog/1931778