This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes Java RMI Beginner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Java RMI Beginner" Watch "Java RMI Beginner" New topic

Java RMI Beginner

rameez hussain

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

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
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 38064
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

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

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

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:
subject: Java RMI Beginner
Similar Threads
Passed SCJP
JavaScript troubles
Graphics and Swing
Check for Arabic Line
Can i get component attribute values inside the component