• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI, maybe a bit offtopic ?

 
Jorgen Sandstrom
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Running RMI server and client on same host works fine.

When starting my RMI server the java code:
InetAddress.getLocalHost().getHostAddress() - returns 127.0.0.1 but I need the public LAN ip adress: 192.168.0.100 (My linuxserver)

Can solve this with -Djava.rmi.server.host=192.168.0.100 when starting the server but no -D parmeters is allowed in SCJD.

How to configure this on linux

/etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.0.100 ???

BR
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure to understand your question. All I can tell you is that when your client needs to connect to your server you can use Locate.getRegistry(String host, int port) to get access to the RMI registry running on your server.

Here is where you have to provide the IP address of the machine where the RMI server is running. And that should suffice to your intentions.

Does this help anyhow?
 
Jorgen Sandstrom
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

It's a linux config problem (FC5)

Orginal /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost

Hacked /etc/hosts (Linux has now the static ip 192.168.0.100)
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1 localhost.localdomain localhost
192.168.0.100 localhost.localdomain localhost

Getting the server ip from javacode (when starting rmi server)
InetAddress.getLocalHost().getHostAddress() - Now gives me the wanted ip 192.168.0.100 and the windows client can log on and perform remote method calls...jippie.

If anyone nowes how to configure (in a proper way) this without unmark loopback 127.0.0.1 I would be happy.

Late friday afternoon here in sweden, time for somthing good to eat...and drink.

BR
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic