title: Why RMI registry is ignoring the java.rmi.server.codebase property
body: <p>I am running a Hello World example for java RMI</p>
  
  <p>1) I run the registry in an empty folder  </p>
  
  <pre><code>motta@motta-laptop ~/tmp $ rmiregistry
  </code></pre>
  
  <p>2) I start the HTTP server to retrieve the classes at runtime. The download folder contains the remote interface for the client-server </p>
  
  <pre><code>motta@motta-laptop ~/download $ java NanoHTTPD 8080
  </code></pre>
  
  <p>3) I start the server passing the java.rmi.server.codebase property as suggested in the java RMI tutorial </p>
  
  <pre><code>motta@motta-laptop ~/server $ java -Djava.rmi.server.codebase="http://localhost:8080" WarehouseServer
  </code></pre>
  
  <p>The RMI registry is not contacting the HTTP server and is throwing an exception (see details after the question). 
  <strong>But if I do the following</strong></p>
  
  <p>1) Start the rmi registry with the java.rmi.server.codebase property</p>
  
  <pre><code>motta@motta-laptop ~/tmp $ rmiregistry -J-Djava.rmi.server.codebase="http://localhost:8080/"
  </code></pre>
  
  <p>2) Start the HTTP server as before</p>
  
  <p>3) Start the server without any option</p>
  
  <pre><code>motta@motta-laptop ~/server $ java WarehouseServer
  </code></pre>
  
  <p><strong>it works, but why?</strong> It seems that with the first procedure the RMI registry is ignoring the java.rmi.server.codebase property</p>
  
  <p>Thank you</p>
  
  <p>=================================</p>
  
  <p>I am running</p>
  
  <pre><code>java version "1.7.0_21"
  Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
  Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
  </code></pre>
  
  <p>The exception from the RMI registry</p>
  
  <pre><code>Constructing server implementation...
  Binding server implementation to registry...
  Exception in thread "main" java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
  java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
  java.lang.ClassNotFoundException: Warehouse
  at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:419)
  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
  at sun.rmi.transport.Transport$1.run(Transport.java:177)
  at sun.rmi.transport.Transport$1.run(Transport.java:174)
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:722)
  at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
  at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:377)
  at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
  at WarehouseServer.main(WarehouseServer.java:14)
  </code></pre>