com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

启动Tomcat时,发生如下异常:

DEBUG resourcepool.BasicResourcePool  - An exception occurred while acquiring a poolable resource. Will retry. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  at java.lang.reflect.Constructor.newInstance(Constructor.java:525)  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)  at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1129)  at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:358)  at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2489)  at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2526)  at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2311)  at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)  at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  at java.lang.reflect.Constructor.newInstance(Constructor.java:525)  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)  at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)  at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347)  at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)  at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)  at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)  at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)  at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)  at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)  at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)  at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) Caused by: java.net.ConnectException: Connection refused: connect  at java.net.DualStackPlainSocketImpl.connect0(Native Method)  at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)  at java.net.Socket.connect(Socket.java:579)  at java.net.Socket.connect(Socket.java:528)  at java.net.Socket.<init>(Socket.java:425)  at java.net.Socket.<init>(Socket.java:241)  at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)  at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:308)  ... 20 more

异常截图:

最终找到原因:

  因为是一开机就直接启动项目,忘记打开数据库服务,所以报了ConnectionException,打开数据库服务马上就好使了。

时间: 2024-08-02 06:58:11

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure的相关文章

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 数据库报错

-- 查询mysql 数据库链接空闲时间持有最大空闲时间,单位为秒 SHOW VARIABLES WHERE VAriable_name = 'interactive_timeout'; -- 会出现wait_timeout与该参数意思相近,修改时,一起修改 SHOW VARIABLES WHERE VAriable_name = '%timeout'; -- 解决问题 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Commun

mysql 5.1超过默认8小时空闲时间解决办法(错误:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure)

报错: MySQL第二天早上第一次连接超时报错, com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 原因: 上述问题是由mysql5数据库的配置引起的.mysql5将其连接的等待时间(wait_timeout .interactive_timeout)缺省为8小时.在其客户程序中可以这样来查看其值: mysql> show global variables like 'wait

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

1.错误描述 [ERROR:]2015-11-05 14:37:52,558 [插入失败] report.service.impl.ReportServiceImpl org.hibernate.exception.JDBCConnectionException: error executing work at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegat

异常解决com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

21:37:08,815 DEBUG BasicResourcePool:1831 - An exception occurred while acquiring a poolable resource. Will retry.com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was

MySQL出现:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago.

1.首先检查生产环境的机器是否ping的通和telnet的通数据库 2.排查数据库连接的参数 3.看数据量是否很大 参考: http://blog.csdn.net/sclxf/article/details/5775125

nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link fai

今天晚上一个财务子系统上线,部署完成后,测试反馈程序会抽风,一会儿正常,一会儿异常,报如下错误: nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link fai 通过查找资料,可能是wait_timeout设置过小导致的,尝试加大wait_timeout的值后,系统恢复正常. 更改过程如下: ##查看MySQL配置 [email protected]:mysq

mysql 数据库问题com.mysql.jdbc.exceptions.jdbc4.CommunicationsException

本文转自:http://blog.csdn.net/zmzsoftware/article/details/6835604 MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link fa

【第一个项目】MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:

MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago 最近碰到一个mysql5

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 successfully received from the server was 78,050,512 milliseconds ago. The last packet sent successfully to the server was 78,050,512 milliseconds ago.