节摘自:http://blogger.org.cn/blog/more.asp?name=sixsun&id=10349
关于【NESTED BEGIN EXCEPTION】http://forums.mysql.com/read.php?39,34091,34091#msg-34091
java.net.SocketException
MESSAGE: java.net.BindException: Address already in use: connect
MySQL Connectors » JDBC » NESTED BEGIN EXCEPTIOn
NESTED BEGIN EXCEPTIOn
Posted by: Rakesh BK (IP Logged)
Date: July 13, 2005 02:24AM
While connecting to Mysql DB from JBOSS server i am getting the following exception..
Please suggest some solution .
Details of the exception
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.BindException: Address already in use: connect
STACKTRACE:
java.net.SocketException: java.net.BindException: Address already in use: connect
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:151)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:281)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1696)
at com.mysql.jdbc.Connection.<init>(Connection.java:408)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:270)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
** END NESTED EXCEPTION **
11:22:10,628 ERROR [STDERR] at com.mysql.jdbc.Connection.createNewIO(Connection.java:1
759)
11:22:10,628 ERROR [STDERR] at com.mysql.jdbc.Connection.<init>(Connection.java:408)
11:22:10,628 ERROR [STDERR] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegister
ingDriver.java:270)
Thanks
Rakesh.B.K
Re: NESTED BEGIN EXCEPTIOn
Rakesh,
You're creating more TCP/IP connections than your OS is configured to handle. Are you using a connection pool? Is there some other process which creates many TCP/IP connections on your system?
-Mark
--
Mark Matthews
MySQL AB, Software Development Manager - Client Connectivity
www.mysql.com
David,
You're creating connections faster than your OS can recycle sockets out of TIME_WAIT status. That is why you get the exception you posted.
Connections should be relatively long-lived objects, maybe you should investigate re-using them within your application or via a connection pool?
-Mark
--
Mark Matthews
MySQL AB, Software Development Manager - Client Connectivity
www.mysql.com
Yes Mark, you are right!!! In addition I would like to warn developers using Win XP with SP 2 that SP 2 introduces a new TCP/IP feature: the number of possible TCP connection attempts is limited to 10 per second. I think that’s why getting an exception related with TCP connections it’s so easy.
Thanks for your help and time,
Best regards,
David Benaderet.
是操作系统问题?不会吧?