| Author |
Java RMI Beginner
|
rameez hussain
Greenhorn
Joined: Sep 15, 2010
Posts: 10
|
|
|
Hey i have just started learning about programming. Im not really good at it. Hoping to get some help here to improve. I just wanted to know how to overcome thw AlreadyBoundException. If someone could help me out with this it would be great.
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
Welcome to the Ranch!
According to the API documentation, "An AlreadyBoundException is thrown if an attempt is made to bind an object in the registry to a name that already has an associated binding."
Without seeing some code, that's as much as I can offer. Can you reduce your code to a simple example that demonstrates the problem?
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
Welcome to the Ranch
You would have to provide much more information than that for us to be able to help. Also that question is too difficult for "beginning Java", so I shall move this thread.
|
 |
junchen liu
Greenhorn
Joined: Feb 19, 2008
Posts: 26
|
|
without seeing you code , I can only assume you are trying to bind your servant on a naming service.
what I would normally do, is to always use "rebind(......)" method(even for the first time) instead of "bind(........)" method.
if you use bind()... then try to bind() again, it will give you alreadyBind error
if you use rebind() initially, then rebind() again, it will just let you override the old reference with new one
the catch is , you code will always work, but it allows multiple instance of servant running, bad or good?
it depends how you control it.
so simply call rebind() should solve your problem
|
 |
rameez hussain
Greenhorn
Joined: Sep 15, 2010
Posts: 10
|
|
|
thank you so much for the reply. yes, im actually trying to modify the "hello world" program and trying to avoid the AlreadyBoundException. So to be clear, if i call rebind() twice, the problem will be solved?
|
 |
junchen liu
Greenhorn
Joined: Feb 19, 2008
Posts: 26
|
|
what i know bind() then bind() definitely not working
in my CORBA program i do rebind() then rebind()
because you are using RMI, it might be different
therefore try rebind() then rebind() if
not working do bind() initially then rebind()
good luck
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Java RMI Beginner
|
|
|