• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to unbind a remote object?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1491
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic