java.io.IOException

javax.naming.NamingException: Cannot lookup'/MyBeanRemote'.
[Root exception is java.rmi.RemoteException: Cannot connect to server 'ejbd://localhost:4201";
nested exception is: java.io.IOException: Cannot connect to server: 'ejbd://localhost:4201'.
Exception: java.net.BindException : Address already in use: connect]
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:214)
at javax.naming.InitialContext.lookup(Unknown Source)
at MyClientScalabilityTest$MyClientTest.call(MyClientScalabilityTest.java:86)
at MyClientScalabilityTest$MyClientTest.call(MyClientScalabilityTest.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.rmi.RemoteException: Cannot connect to server 'ejbd://localhost:4201"; nested exception is:
java.io.IOException: Cannot connect to server: 'ejbd://localhost:4201'.
Exception: java.net.BindException : Address already in use: connect

One possibility is that the available user port numbers are being exhausted. On Windows, when a socket is closed, it goes into a TIME_WAIT state and isn't actually closed until some delay time. By default, the max user port address is 5000 and the TIME_WAIT delay is 4 minutes. So, it's not too difficult to exhaust all possible user port addresses.

You have to update the Windows Registry to change these values. Here's a Windows 2000 doc on the registry settings – http://technet.microsoft.com/en-us/library/bb726981.aspx

  • MaxUserPorts controls the upper range for user ports.
  • TcpTimedWaitDelay controls the TIME_WAIT delay.

Increasing MaxUserPorts (e.g. 65534) and decreasing TcpTimedWaitDelay (e.g. 30) may fix the problem.

  • No labels