title: Exception in thread "main" java.rmi.NotBoundException
body: <p>i have problem that when i run my rmi server i got an exception notbound exception 
  even i export the remote object and bind it to registry
   here is my remote interface code</p>
  
  <pre><code> import java.rmi.Remote;
      public interface fact extends Remote {
      public int factory(int a);
      } 
  </code></pre>
  
  <p>and here the interface implementation    </p>
  
  <pre><code>public class factimport implements fact {
  
      @Override
      public int factory(int a) {
          int mult=1;
          for (int i=1;i&lt;=a;i++)
              mult=mult*i;
          return mult;
      }
  
  }
  </code></pre>
  
  <p>and server code </p>
  
  <pre><code>import java.net.MalformedURLException;
  import java.rmi.RemoteException;
  import java.rmi.registry.LocateRegistry;
  import java.rmi.registry.Registry;
  import java.rmi.server.UnicastRemoteObject;
  
  
  public class Server extends UnicastRemoteObject {
  /**
       * 
       */
      private static final long serialVersionUID = 1L;
  
  protected Server() throws RemoteException {
          super();
  
      }
  
  public static void main() throws RemoteException, MalformedURLException{
      factimport fi=new factimport();
      Registry reg=LocateRegistry.createRegistry(1099);
      reg.rebind("factobject", exportObject(fi));
      System.out.println("server started");
  }
  }
  </code></pre>
  
  <p>and client</p>
  
  <pre><code>import java.net.MalformedURLException;
  import java.rmi.NotBoundException;
  import java.rmi.RemoteException;
  import java.rmi.registry.LocateRegistry;
  import java.rmi.registry.Registry;
  
  
  public class Client {
  
      /**
       * @param args
       * @throws NotBoundException 
       * @throws RemoteException 
       * @throws MalformedURLException 
       */
      public static void main(String[] args) throws MalformedURLException, RemoteException, NotBoundException {
          // TODO Auto-generated method stub
          Registry reg=LocateRegistry.getRegistry("127.0.0.1",1099);
      factimport x=(factimport)reg.lookup("factobject");
      System.out.println(x.factory(5));
  
  }
  }
  </code></pre>