Long story short - I am trying to run an RMI application with a client and a server on separate machines using Windows.
The simplified code in the server is:
System.setProperty("java.rmi.server.hostname", "192.168.x.x");
Registry reg = LocateRegistry.createRegistry(1099);
RemoteFoo foo = new RemoteFoo();
reg.rebind("Foo", foo);
In the client I have:
reg = LocateRegistry.getRegistry("192.168.x.x", 1099);
RemoteFooInterface foo = (RemoteFooInterface) reg.lookup("Foo");
The exception I get is in "Connection refused to host: 192.168.x.x; nested exception is Connection timed out: connect" at the line where I look up the object.
I read some question on StackOverflow from people having a similar issue and that is why I added the line to change the System property in order to embed the correct IP in the stub that the clients use but it still does not work.
I will be very thankful if someone could provide me with some pointers on what else I can try.