If you glance at the title you could have an idea about this exception. It says that Name is Already bounded.

What does it mean?

When we are dealing with RMI, we know that the server needs to register the remote object in the RMI registry with a name. The client will use this name to get the remote object.I have already explained this in my post Java RMI tutorial.Here we have to know one thing that each remote object should be registered with a unique name.

So it is obvious that when two different remote objects are registered with same name then this exception will be thrown for example, if we do like this, then this exception will be thrown.

............................................................................... Context namingContext = new InitialContext();namingContext.bind("rmi:central",store);//binding the remote object store with name centralnamingContext.bind("rmi:central",shop);//binding the remote object shop with name central

What are the other reasons?

In the above shown exmaple, i have registered two different remote objects with same name and so i got this exception thrown, "but the other common reason is trying to re-bind the object with the same name".

When this kind of situation occurs?

I have already told in my post Executing java RMI that to execute an RMI we need to start the rmi registry first and then execute the server and then client. If you set the codebase property correctly it will work fine, but when you try to re-execute the server you may have encountered this exception even though codebase is set correctly. why? because "you have actually tried to re-bind the object that is already bounded with the same name".

Here you should understand that "as long as RMI registry is running the entries of the registry persists until the RMI registry is stopped". so when re-executing the server ensure that the RMI registry is re-started again.