• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to unbind a remote object?

 
Ramses Tutoli
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone tell me what's wrong with the following code? It doesn't work, but no exception is caught either.

the remote object was previously registered with a call to Naming.rebind("contractor", remoteObject);
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may have unbind'ed the connection factory but the remote objects it creates may still be on the server.
Tony
[ September 24, 2003: Message edited by: Tony Collins ]
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramses,
It doesn't work, but no exception is caught either.


What do you mean by saying that it doesn't work?
Best,
Vlad
 
Ramses Tutoli
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have a ConnectionFactory. my remote object is my remote implementation of Data.
"It doesn't work" means that it doesn't seem to unbind the remote object. A subsequent call to rebind() gives me the following error:
java.rmi.server.ExportException: internal error: ObjID already in use
Failed To Register object with the RMI registry
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try getting some more info about the state of the system before and after the unbind():

This may offer more clues, or not. And make sure you see before and after messages. If there's no after, it may mean theres an Error (or other Throwable) being thrown and caught somewhere else (since the code shown only catches Exception, which is normally what you want, but if you've got code somewhere else that manages to hide the error message of an Error...
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11887
203
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramses,
You could also try turning RMI debugging on (see the Useful java.rmi and sun.rmi Properties on the Sun RMI Home page). Then see if the registry gives any information about why it is not unbinding the instance.
Ahhh, the light dawns. This is not a problem with your unbind. For a start, calling rebind() will not warn you about an existing object being bound - it just overwrites it. If you use bind, and the object already exists, then you get a totally different exception: java.rmi.AlreadyBoundException.
The exception you are getting is the one you get when you try to start the registry a second time. If you do that, then you get an stack trace similar to:

See that second last line? The one that has the "LocateRegistry.createRegistry" in it? Do you get that? If not, please post your entire stack trace.
Regards, Andrew
 
Ramses Tutoli
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew, you are right. It was the call the createRegistry() that caused the problem. There doesn't seem to be a way to "uncreate" the registry in Java (other than closing the app), since unbind() just removes the remote object.
I worked my way around this by calling createRegistry() when the server window is opened, and just adding buttons that either bind or unbind the remote object.
 
kri shan
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I worked my way around this by calling createRegistry() when the server window is opened, and just adding buttons that either bind or unbind the remote object.


How should we check server window is opened ?
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kri shan wrote:How should we check server window is opened ?


Howdy, Kri.

Champ, did you see how old this thread is? Instead of waking up zombie threads, please start new ones next time. Also, when you do so, please be more precise in your question (the one you made is too vague).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic