File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java RMI Beginner

 
rameez hussain
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47274
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic