Why does client fail to connect with server IOR set to 127.0.0.1?

From Support
Jump to: navigation, search

Question:

Why does client fail to connect with server IOR set to 127.0.0.1?

Answer:

Product: VBJ 3.x
Platform: NA
JDK: NA
Component: ORB runtime, osagent

Problem: A VBJ server uses 127.0.0.1 as the host in its Interoperable Object Reference (IOR).  This results in a CORBA::NO_IMPLEMENT, COMM_FAILURE exception in the client that attempts to connect to the server.

Other symnptoms/disgnostics that indicate this problem:

(1) The VBJ ORBdebug output in the client shows attempts to conect to the server on IP address 127.0.0.1.

(2) The osagnet verbose output shows that server registers its IP address as 127.0.0.1.  For example:

  • --- Received a getProvider message from client--*

Host Name: somehost
Login Name: java
Client User name: java
Process id: -666392044
Service Name: 'IDL:geo/transact/PaymentSystem/PaymentProxyService/CashRegisterFactoryInterface:1.0_CashRegisterFactory'
Service Type: (4)
Argument type: NCObject
Replying with the following provider.
Internet address: 127.0.0.1
Port number: 34703

If the IP address is 127.0.0.1, which is the "localhost" IP address, the client will not be able to connect to this server if it is running on a different machine.

The problem is that the server thinks it is running on address 127.0.0.1. The most commonly encountered cause of this problem is a bug in the Java VM, which  has a problem in resolving the hostname in /etc/hosts. This is JDK bug number 4073539 and an associated Solaris bug number 4185755. The JDC or the JavaSoft partner web site have more information on this bug if you want to research this further. Similar behavior not associated directly with this JDK bug has been seen on platforms other than Solaris.  If this behavior is seen, the correct approach to resolving it is to work with the JDK supplier to determine why the Java Virtual machine thinks that the 127.0.0.1 is the IP address of the host.

The workaround for JDK bug 4073539 is to modify the etc/hosts file so that the host name precedes the "localhost" entry.  This usually resolves the problem.

This problem may also be avoided by forcing the ORB to use a specific IP address using the OAipAddr property when starting the server:

    vbj -DOAipAddr=176.23.34.12 Server



Article originally contributed by Borland Developer Support