Running Java RMI application on two machines - ConnectException

PetarMI

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.

Jp Vinjamoori

It could be that firewall on the server is blocking access.

Ensure that you can connect to the port, in your case, 1099. For example, from your client machine, open command prompt cmd.exe and type telnet 192.168.x.x 1099 (this will connect to port 1099 on the server). If it says 'Connecting To ...' then that port is not available and its very likely that client machine is unable to reach the server. Try ping 192.168.x.x (it will work if ICMP is allowed by server's firewall).

Try fixing the firewall to allow connections through port 1099 or better disable it (temporarily) and give it a try again. Once cleared, run the RMI client

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Java RMI: running RMI application over the Internet with public IP of router

From Dev

java.rmi.ConnectException: Connection refused to host: 127.0.0.1

From Dev

java.rmi.ConnectException: Connection refused to host: <public IP>

From Dev

Terminate Java RMI server application

From Dev

RMI Java application not working as expected

From Dev

rsync running at the same time on two machines

From Dev

Java RMI application doesn't quit

From Dev

Is there a way to completely disable RMI in a java application?

From Dev

Is there a way to completely disable RMI in a java application?

From Dev

java.net.ConnectException: Connection refused error when running Hive

From Dev

java chat application not working on other machines

From Dev

Handling cache in play framework while application is running on multiple machines

From Dev

Merge two *.jtl file of test report running on different machines

From Dev

Transfer files between two Windows machines, one running under VMware

From Dev

using vmware 15 for running two virtual machines of 350 Gb on a laptop

From Dev

Connect two different ubuntus running on different machines and different networks

From Dev

Running Tomcat causes java.rmi.ServerException in the unrelated project

From Dev

Getting NotBoundException while writing a Java RMI chat application :-/

From Dev

Hadoop standalone installation - java.net.ConnectException: Connection refused error while running jar

From Dev

Getting java.net.ConnectException: your endpoint configuration is wrong when running ./yarn command

From Dev

Running mpi on multiple machines

From Dev

Running mpi on multiple machines

From Dev

Java+Netbeans significant graphics performance variation between two machines

From Dev

Running two versions of java on the same linux server via same user for different application

From Dev

Elevate Java application while running

From Dev

Identify Java version of a running application

From Dev

java - which webserver is the application running on

From Dev

Debug a running java application in eclipse?

From Dev

Running Java application in Android Studio

Related Related

  1. 1

    Java RMI: running RMI application over the Internet with public IP of router

  2. 2

    java.rmi.ConnectException: Connection refused to host: 127.0.0.1

  3. 3

    java.rmi.ConnectException: Connection refused to host: <public IP>

  4. 4

    Terminate Java RMI server application

  5. 5

    RMI Java application not working as expected

  6. 6

    rsync running at the same time on two machines

  7. 7

    Java RMI application doesn't quit

  8. 8

    Is there a way to completely disable RMI in a java application?

  9. 9

    Is there a way to completely disable RMI in a java application?

  10. 10

    java.net.ConnectException: Connection refused error when running Hive

  11. 11

    java chat application not working on other machines

  12. 12

    Handling cache in play framework while application is running on multiple machines

  13. 13

    Merge two *.jtl file of test report running on different machines

  14. 14

    Transfer files between two Windows machines, one running under VMware

  15. 15

    using vmware 15 for running two virtual machines of 350 Gb on a laptop

  16. 16

    Connect two different ubuntus running on different machines and different networks

  17. 17

    Running Tomcat causes java.rmi.ServerException in the unrelated project

  18. 18

    Getting NotBoundException while writing a Java RMI chat application :-/

  19. 19

    Hadoop standalone installation - java.net.ConnectException: Connection refused error while running jar

  20. 20

    Getting java.net.ConnectException: your endpoint configuration is wrong when running ./yarn command

  21. 21

    Running mpi on multiple machines

  22. 22

    Running mpi on multiple machines

  23. 23

    Java+Netbeans significant graphics performance variation between two machines

  24. 24

    Running two versions of java on the same linux server via same user for different application

  25. 25

    Elevate Java application while running

  26. 26

    Identify Java version of a running application

  27. 27

    java - which webserver is the application running on

  28. 28

    Debug a running java application in eclipse?

  29. 29

    Running Java application in Android Studio

HotTag

Archive