开发者

mysql jdbc communicationexception

I have BLManager class that first open connection and called Data manager class to get data from database and return list of VO containing that data.

After completing all calculation in BL manager i call the method that commit transaction and close the connection.

This is the flow that i follow for opening and closing database connection. Today i face some strange exception described as follow

com.mysql.jdbc.CommunicationsException: The driver was unable to create a connection due to an inability to establish the client portion of a socket.

This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable. 

For Unix-based platforms, see the manual page for the 'ulimit' command. Kernel or system reconfiguration may also be required.

For Windows-based platforms, see Microsoft Knowledge Base Article 196271 (Q196271).
 at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)
 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2104)
 at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:729)
 at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:298)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:283)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at com.cc.jas.datamanager.util.db.DBManager.getConnection(DBManager.java:83)
 at com.cc.jas.blmanager.base.BaseBLManager.startTransaction(BaseBLManager.java:252)
 at com.cc.jas.blmanager.system.systemconfig.SystemConfigBLManager.getConfigMap(SystemConfigBLManager.java:82)
 at com.cc.jas.delegate.system.systemconfig.SystemConfigBusinessDelegate.getConfigMap(SystemConfigBusinessDelegate.java:39)
 at com.cc.jas.common.cache.SystemConfigCacheManager.reloadCache(SystemConfigCacheManager.java:120)
 at com.cc.jas.common.cache.SystemConfigCacheManager.getParameterValue(SystemConfigCacheManager.java:53)
 at com.cc.jas.model.base.BaseReportVO.getDisplayDate(BaseReportVO.java:116)
 at com.cc.jas.model.account.rvo.AccountItemReportVO.getDateString(AccountItemReportVO.java:111)
 at sun.reflect.GeneratedMethodAccessor333.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
 at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1132)
 at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)
 at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
 at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)
 at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:115)
 at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:100)
 at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:104)
 at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:787)
 at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:751)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1422)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:879)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:801)
 at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:536)
 at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:63)
 at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:209)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.net.BindException: Address already in use: connect
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(Unknown Source)
 at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
 at java.net.PlainSocketImpl.connect(开发者_StackOverflow中文版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.<init>(Unknown Source)
 at java.net.Socket.<init>(Unknown Source)
 at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2027)

What this exception says and what is solution for that ?


Caused by: java.net.BindException: Address already in use: connect

This says that the ip:port you are trying to bind with process is already binded with some other process.


try doing ping 127.0.0.1 to see if tcp/ip is working or not.then use netstat -a to see the open ports and sockets.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜