title: Java RMI - ClassNotFound exception
body: <p>I'm creating a Java RMI program, but I'm getting a ClassNotFoundException.
  Could you guys help me figure it out? I'm using Eclipse.
  Somebody suggested me it was a codebase problem, but how does this relate?
  Here are the codes for my Server and Client:</p>
  
  <p>Server:</p>
  
  <pre><code>    package server;
  
  import java.rmi.registry.LocateRegistry;
  import java.rmi.registry.Registry;
  import java.rmi.server.UnicastRemoteObject;
  
  import base.Server;
  import base.RmiStarter;
  
  public class ServerImplStarter extends RmiStarter{
  
      public ServerImplStarter() {
          super(Server.class);
      }
  
      @Override
      public void doCustomRmiHandling() {
          try{
              Server engine = new ServerImpl();
              Server engineStub = (Server)UnicastRemoteObject.exportObject(engine, 0);
  
  
              Registry registry = LocateRegistry.createRegistry( 1099 );
              registry = LocateRegistry.getRegistry();
              registry.rebind("Server", engineStub);
  
          }catch(Exception e){
              e.printStackTrace();
          }
  
      }
  
      public static void main(String[] args){
          new ServerImplStarter();
      }
  
  }
  </code></pre>
  
  <p>Client:</p>
  
  <pre><code>package client;
  
  import java.rmi.registry.LocateRegistry;
  import java.rmi.registry.Registry;
  
  import base.RmiStarter;
  import base.Server;
  import base.Cell;
  
  public class CellClient extends RmiStarter {
  
      public CellClient() {
          super(Server.class);
      }
  
      @Override
      public void doCustomRmiHandling() {
          try{
              Registry registry = LocateRegistry.getRegistry();
              Server server = (Server)registry.lookup("Server");
  
              Cell c = null;
              c = server.getcell();
  
          }catch(Exception e){
              e.printStackTrace();
          }
      }
  
      public static void main(String[] args) {
          new CellClient();
      }
  
  }
  </code></pre>
  
  <p>and the error is this:</p>
  
  <pre><code>java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
      java.lang.ClassNotFoundException: server.CellImpl
      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
      at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source)
      at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)
      at $Proxy0.getcell(Unknown Source)
      at client.CellClient.doCustomRmiHandling(CellClient.java:23)
      at base.RmiStarter.&lt;init&gt;(RmiStarter.java:19)
      at client.CellClient.&lt;init&gt;(CellClient.java:13)
      at client.CellClient.main(CellClient.java:31)
  Caused by: java.lang.ClassNotFoundException: server.CellImpl
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
      at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
      at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
      at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
      at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
      at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
      at java.io.ObjectInputStream.readClassDesc(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source)
      ... 8 more
  </code></pre>