• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Java RMI Beginner

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 80230
424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
mooooooo ..... tiny ad ....
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic