aspose file tools*
The moose likes Distributed Java and the fly likes RMI,can't get connect two computers. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI,can Watch "RMI,can New topic
Author

RMI,can't get connect two computers.

Robson Martinz
Ranch Hand

Joined: Jun 01, 2012
Posts: 31
I am noob in RMI and the material on the Internet is kind of hard to understand because the examples are all on the same computer which is odd, since the main purpose of the RMI is another. I tried to implement the server in a computer, and the client on another computer and follow the codes as below:

What is wrong ?

Computer 1 ->Server:
http://pastebin.com/q5p1PPgp

Computer 2-> Client:
http://pastebin.com/uH3pqBqv

Thanks.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

RMI is a poor choice if the two computers are on the general internet. It is rare for systems on the Internet to have the necessary ports open for RMI communications.

You may want to read my thread:
http://www.coderanch.com/t/570237/java/java/Why-there-still-interest-lots

In general, RMI is no longer a good choice for general problems. It was occasionally useful back in the 1990s, but there are simply too many problems to justify using it.

Use something like REST over normal HTTP.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4658
    
    5

Please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/advanced-java/60365-rmi-cant-get-connect-two-computers.html
https://forums.oracle.com/forums/thread.jspa?messageID=10372062 (currently down for maintenance)


luck, db
There are no new questions, but there may be new answers.
Robson Martinz
Ranch Hand

Joined: Jun 01, 2012
Posts: 31
I'm sorry, I'm trying to solve this problem a long time so I decided to try in other forums as well.
I'll put my source code here and the exception to. I don't know what i'm doing wrong, need solve this for a college work.

Computer 1 Server i put this code:


Computer 2 Client i put this code:


Error message:
RemoteException: java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused

Thank You.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Robson Martinz wrote:Error message:
RemoteException: java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused


Either your RMI service is not running, so it could not make the connection, your your computer's operating system firewall is preventing the connection.
If its the firewall, then you will have to reconfigure the firewall.

The problem of firewall ports used by RMI can not be solved in a commercial or enterprise environment. That is the biggest problem with trying to use RMI, and why the technology is dead, and has been dead all of this century.

Robson Martinz
Ranch Hand

Joined: Jun 01, 2012
Posts: 31
I'm using in both computers Linux Mint with Javac 1.6.0_20.
What do i have to do to know if RMI service is running?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI,can't get connect two computers.