IBM Support

RMI RemoteException Connection Refused to Host: w.x.y.z

Troubleshooting


Problem

A TCP configuration that is not correct will cause RMI clients to be rejected.

Resolving The Problem

RMI applications will receive the following error if the TCP host or DNS information is configured incorrectly:

RemoteException Connection refused to host: w.x.y.z
java.net.ConnectException: A remote host refused an attempted connect operation.

The RMI client first connects to the RMIRegistry port (default is 1099) to query for the desired class. The RMIRegistry reply includes the TCP/IP address and port number the client should reconnect to. The RMIRegistry appears to use the socket layers gethostname and gethostbyname to retrieve the IP address from the local system. The TCP/IP address returned to the client may be different than the TCP/IP address the client first used to connect to the RMIRegistry. If the TCP is not configured correctly, the TCP/IP address returned may be for the incorrect host, an inactive interface, or have no route defined.

The following is the reply from the RMIRegistry. Note that, even over loopback, this reply has a external IP address and the port number the client should reconnect to:

       51ACED00  05770F01  521E0690  000000F7     <...............7>   <Q....w..R.......>
       873FFFDE  80057372  001D6578  616D706C     <g.........../_.%>   <.?....sr..exampl>
       65732E68  656C6C6F  2E48656C  6C6F496D     <.....%%?...%%?._>   <es.hello.HelloIm>
       706C5F53  74756200  00000000  00000202     <.%..............>   <pl_Stub.........>
       00007078  72001A6A  6176612E  726D692E     <.......././.._..>   <..pxr..java.rmi.>
       73657276  65722E52  656D6F74  65537475     <........._?.....>   <server.RemoteStu>
       62E9FEDC  C98BE165  1A020000  70787200     <.Z..I...........>   <b......e....pxr.>
       1C6A6176  612E726D  692E7365  72766572     <.././.._........>   <.java.rmi.server>
       2E52656D  6F74654F  626A6563  74D361B4     <..._?..|.....L/.>   <.RemoteObject.a.>
       910C6133  1E030000  70787077  32000A55     <j./.............>   <..a3....pxpw2..U>
       6E696361  73745265  66000939  2E352E34     <>../............>   <nicastRef..9.5.4>
       2E313433  000022A6  00000000  00000000     <.......w........>   <.143..".........>
       18A60A8D  000000F7  87413D30  80000178     <.w.....7g.......>   <.........A=0...x>

In this example, the client will attempt to reconnect to TCP/IP address 9.5.4.143 port x22A6(8870).

Note: To trace RMI calls, all adapters must be traced because more than one interface may be used.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]

Historical Number

317075296

Document Information

Modified date:
18 December 2019

UID

nas8N1016379