java.rmi.NotBoundException

10,508

Solution 1

A NotBoundException is thrown if an attempt is made to lookup or unbind in the registry a name that has no associated binding.

What is your server code look like? This exception you are having most likely caused by server not set up properly.

I think in your server code you are bind with name ChatServer

 Naming.rebind("ChatServer", new Server());

But in your client code you are using ServerInterface name

String address = "rmi://localhost/ServerInterface";

For more details Naming

Solution 2

It looks like you are attempting to look up a name that is not bound.

public class NotBoundException extends Exception

A NotBoundException is thrown if an attempt is made to lookup or unbind in the registry a name that has no associated binding.

Share:
10,508
san88
Author by

san88

Updated on June 04, 2022

Comments

  • san88
    san88 almost 2 years

    i have written small RMI chat program and its compiling properly.but when i try to run Client program it results exception "java.rmi.NotBoundException - ServerInterface" Server program runs without any errors..please help me to solve this.

    here is some of Client code

    public static void main (String[] args)
    {
    String address = "rmi://localhost/ServerInterface";
    try
    {
    ServerInterface si= (ServerInterface) Naming.lookup(address);
    new Thread(new Client(si)).start();
    }
    catch (Exception e)
    {
    System.err.println(e.toString()) ;
    }
    }
    
  • user207421
    user207421 over 11 years
    'Mainly'? What other reason is there?
  • san88
    san88 over 11 years
    thnak you..i correct that to Naming.rebind("ServerInterface", new Server())..but still it produces the same error like before ServerInterface is the interface which im implement Server program
  • user207421
    user207421 over 11 years
    @SumitSingh I read your answer. I am asking you a question about it. You haven't answered it. 'Mainly' implies that there are other causes. What other cause is there?
  • user207421
    user207421 over 11 years
    @SumitSingh Wrong again, nothing to do with me, and no misunderstanding either. Just a complete failure to answer my question.
  • user207421
    user207421 over 11 years
    @MukulGoel I could show you dozens. I saw one today with a tick and 20 upvotes that went to 19 for some unexplained reason.
  • Mukul Goel
    Mukul Goel over 11 years
    @EJP , ahaan.. strange. .. Sir, I aint getting between you and Sumit. I just browsed to this post and without reading comments I made my comment. :) ;)