码迷,mamicode.com
首页 > 其他好文 > 详细

error:No buffer space available (maximum connections reached

时间:2015-12-21 18:09:05      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

 

2015-02-02 17:49:09,035 ERROR basic.DBManager - Failded to establish the connection.
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(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
 at java.lang.reflect.Constructor.newInstance(Unknown Source)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
 at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
 at com.mysql.jdbc.MysqlIO.(MysqlIO.java:344)
 at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2333)
 at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)
 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
 at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:792)
 at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47)
 at sun.reflect.GeneratedConstructorAccessor4.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
 at java.lang.reflect.Constructor.newInstance(Unknown Source)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
 at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at java.sql.DriverManager.getConnection(Unknown Source)
 ...

Caused by: java.net.SocketException: No buffer space available (maximum connections reached?): connect
 at java.net.DualStackPlainSocketImpl.connect0(Native Method)
 at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
 at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
 at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
 at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
 at java.net.PlainSocketImpl.connect(Unknown Source)
 at java.net.SocksSocketImpl.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at java.net.Socket.(Unknown Source)
 at java.net.Socket.(Unknown Source)
 at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
 at com.mysql.jdbc.MysqlIO.(MysqlIO.java:294)
 ... 19 more
Exception in thread "main" java.lang.NullPointerException
 ...

 

最后的NullPointerException是指connection。

 

解决方案:减少connection的数量。

参考:http://ilyljc007.blog.163.com/blog/static/1623518992011111162336911/

原因:与db的连接过多。即使connection closed也不行。

error:No buffer space available (maximum connections reached

标签:

原文地址:http://www.cnblogs.com/zhengah/p/5063898.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!