A
Alexander N. Spitzer
If I have a machine with 3 virtual IP addresses (192.168.1.[5-7]), how
can I start 3 instances of the same RMI application (each started with
different properties/configs), each listening on the port 1234, but each
instance binds to a different ip address.
that is to say:
instance #1 binds to 192.168.1.5/port 1234
instance #2 binds to 192.168.1.6/port 1234
instance #3 binds to 192.168.1.7/port 1234
I guess I am looking for something like:
Registry registry = LocateRegistry.createRegistry(<IPADDR>,<PORT>);
I tried
System.setProperty("java.rmi.server.hostname","<IPADDR>");
but had no luck
current code looks something like this:
/******* server side *********/
System.getProperties().setProperty("java.rmi.server.hostname",serverip);
Registry registry = LocateRegistry.createRegistry(serverport);
registry.rebind("RMITest", this);
//serverip is the IP to bind to... server port is port 1234
/******* client side **********/
Registry registry=LocateRegistry.getRegistry(serverip,serverport);
RMITestInterface rmit=(RMITestInterface)(registry.lookup("RMITest"));
rmit.dosomethingcool();
second instance (even though serverip is different) complains
java.rmi.server.ExportException: Port already in use:1234; nested
exception is: java.net.BindException: Address already in use
These have to be seperate instances of the application for each
customer... I know that it is possible to run them on different ports,
but this is really not acceptable in a large clustered environment. this
would become a complete nightmare very quickly.
what am I missing?!?! I have googled high and low, and looked through
all my java books, but see no mention of such a scenario! anyone?
TIA!
-alex
can I start 3 instances of the same RMI application (each started with
different properties/configs), each listening on the port 1234, but each
instance binds to a different ip address.
that is to say:
instance #1 binds to 192.168.1.5/port 1234
instance #2 binds to 192.168.1.6/port 1234
instance #3 binds to 192.168.1.7/port 1234
I guess I am looking for something like:
Registry registry = LocateRegistry.createRegistry(<IPADDR>,<PORT>);
I tried
System.setProperty("java.rmi.server.hostname","<IPADDR>");
but had no luck
current code looks something like this:
/******* server side *********/
System.getProperties().setProperty("java.rmi.server.hostname",serverip);
Registry registry = LocateRegistry.createRegistry(serverport);
registry.rebind("RMITest", this);
//serverip is the IP to bind to... server port is port 1234
/******* client side **********/
Registry registry=LocateRegistry.getRegistry(serverip,serverport);
RMITestInterface rmit=(RMITestInterface)(registry.lookup("RMITest"));
rmit.dosomethingcool();
second instance (even though serverip is different) complains
java.rmi.server.ExportException: Port already in use:1234; nested
exception is: java.net.BindException: Address already in use
These have to be seperate instances of the application for each
customer... I know that it is possible to run them on different ports,
but this is really not acceptable in a large clustered environment. this
would become a complete nightmare very quickly.
what am I missing?!?! I have googled high and low, and looked through
all my java books, but see no mention of such a scenario! anyone?
TIA!
-alex