Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

RMI,can't get connect two computers.

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 4686
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Robson Martinz
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4686
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!