Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI remote Exception

 
Farzane Arabi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some problem in working on java RMI in netbeans IDE6.0
when I run the server this exception is represented :

Remote exception: java.rmi.ConnectException: Connection refused to host: 192.168.73.68; nested exception is:
java.net.ConnectException: Connection refused: connect
It seems I have no permisson to port, and I dont know how I can activate the premission

I'll be thank ful if you help me

the code is as symple as below:
 
Oscar Costa
Ranch Hand
Posts: 31
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You started the rmiregistry?

Try this code from server side:



Look at official sun documentation http://java.sun.com/javase/6/docs/technotes/guides/rmi/index.html
 
Farzane Arabi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Oscar for your help,
I inserted your code but unfotunatly after debug this line:

"Remote serverStub = UnicastRemoteObject.exportObject(Server, 0);"

this exception represented:

"Remote exception: java.rmi.server.ExportException: object already exported"

It seems there is no need to export the object by insrting this line and and making an obbject of "SampleServerImpl" is enougth to export the Server object,
If there is any idea I'll be thankful

 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Farzane,

It's a bit difficult to read through your code. Please use code tags in future.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Farzane Arabi wrote:
It seems there is no need to export the object by insrting this line and and making an obbject of "SampleServerImpl" is enougth to export the Server object,


Yeah you do not need to export it. UnicastRemoteObject constructor exports automatically.
Did you try to use the rmi registry as told by Oscar?
Naming requires the name to be in the format of a URL and not a simple name. See javadocs for details.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic