It doesn't work, but no exception is caught either.
What do you mean by saying that it doesn't work? Best, Vlad
Joined: Sep 05, 2003
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
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...
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
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 wrote:How should we check server window is opened ?
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).