JDK-6754672 : java.io.IOException: The server sockets created using the LocalRMIServerSocketFactory
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: OpenJDK6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux_ubuntu
  • CPU: x86
  • Submitted: 2008-10-01
  • Updated: 2010-09-29
  • Resolved: 2008-11-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u12 b01Fixed 7Resolved OpenJDK6Fixed
Description
Monitoring application with JConsole thows IOException in monitored application. This seems to be Ubuntu only issue.
Steps how to reproduce on clean install of Ubuntu 8.0.4:
1) Start Notepad with OpenJDK build 1.6.0_0-b11
java -jar /usr/lib/jvm/java-6-openjdk/demo/jfc/Notepad/Notepad.jar
2) start JConsole and attach to Notepad running on the same machine
3) The following exception is printed to console from Notepad:

01 Oct 2008 2:16:22 PM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAcceptLoop
WARNING: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=37278] throws
java.io.IOException: The server sockets created using the LocalRMIServerSocketFactory only accept connections from clients running on the host where the RMI remote objects have been exported.
	at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:89)
	at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:387)
	at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:359)
	at java.lang.Thread.run(Thread.java:636)

Comments
WORK AROUND There are two possible workaround: 1) fix etc hosts or 2) disable local host checks. Disabling local host checking can be done in two ways: a) system-wide: uncomment the line # com.sun.management.jmxremote.local.only=false in jre/lib/management/management.properties b) process based: pass -Dcom.sun.management.jmxremote.local.only=false on the java command line (attachee side)
03-10-2008

SUGGESTED FIX There is a easy fix for this problem. Before checking IP address of all network interfaces, check that h=the remote address is loopback address. See the diff below: --- LocalRMIServerSocketFactory.java.orig 2008-10-01 15:53:58.000000000 +0200 +++ LocalRMIServerSocketFactory.java 2008-09-30 16:50:22.000000000 +0200 @@ -55,6 +55,9 @@ "LocalRMIServerSocketFactory only accept connections " + "from clients running on the host where the RMI " + "remote objects have been exported."; + if (remoteAddr.isLoopbackAddress()) { + return socket; + } // Retrieve all the network interfaces on this host. Enumeration<NetworkInterface> nis; try {
01-10-2008

EVALUATION This seems to be caused by this entry in /etc/hosts 127.0.1.1 ubuntu.localdomain ubuntu This is done by default Ubuntu installation. 127.0.1.1 is than used as remoteAddr in sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(). Subsequently 127.0.1.1 fails to be detected as IP address of any of the installed network interfaces and java.io.IOException is thrown. This problem can be also reproduce with JDK 6. It does not exist in JDK 7. *** (#1 of 1): [ UNSAVED ] ###@###.###
01-10-2008