classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RMI and java.rmi.server.hostname


From: Lorenz Witte
Subject: RMI and java.rmi.server.hostname
Date: Wed, 11 Jan 2006 12:43:20 +0100
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050715)

Hello everyone,

I've been experimenting a little with RMI and GNU Classpath and ran into troubles when client and server were running on different machines. In my setup the client "hercules" is trying to access a UnicastRemoteObject on the server "galahad". The client is able to receive the corresponding stub, but it is misconfigured so that it tries to access the remote object on localhost instead of the real server. Using Sun's JRE on the server I could solve the problem by setting the system property "java.rmi.server.hostname" to "galahad". Unfortunately this failed when using GNU Classpath and Kaffe or JamVM on the server. The stubs were still trying to access localhost.

Currently I meet the problem by modifying the static constructor of gnu.java.rmi.server.UnicastConnectionManager, so that the static field "localhost" is initialized with the value of the java.rmi.server.hostname property, i.e. I replaced the line

  localhost = InetAddress.getLocalHost().getHostAddress();

with the following code:

  localhost = System.getProperty( "java.rmi.server.hostname");
  if ( localhost == null) {
     localhost = InetAddress.getLocalHost().getHostAddress();
  }

Now I can properly access the GNU Classpath based RMI server from a remote client, but I don't have a clue if this patch is valid by any means (as my knowledge on both RMI and Classpath can be described as shallow at best).

Any advice is welcome!

Lorenz Witte
address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]