Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Distributed Java and the fly likes how to make sure rmi object is exported Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "how to make sure rmi object is exported" Watch "how to make sure rmi object is exported" New topic

how to make sure rmi object is exported

Simon Simbolon

Joined: Apr 15, 2010
Posts: 5
Is there any way I can make sure that an object has been exported when I called UnicastRemoteObject.exportObject(Stub,0)?

I'm having some cases when running the server apps with no exception, but sometimes the exported object is not found by the client, therefore producing this:

java.rmi.NoSuchObjectException: no such object in table

please help?
Pierre Sugar
Ranch Hand

Joined: Dec 08, 2002
Posts: 62

There are sevaral forums discussing the topic. The reason to that is that the object on the server has been garbage collected like stated in the forums. To avoid this you have to hold a reference to the object. Details you can find e.g. at sun's forum, Stackoverflow or here.

Ram Narayan.M
Ranch Hand

Joined: Jul 11, 2010
Posts: 247

Did you put the RemoteObject in rmiregistry using Naming or Registry bind() or rebind() methods?... Using exportObject() means that the Object is eligible to be placed in Naming service...

SCJP 6 [SCJP - Old is Gold]
I agree. Here's the link:
subject: how to make sure rmi object is exported
It's not a secret anymore!