When I am doing some RMI programming for Java, I encountered the following error
Error starting the server: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
A search through Web revealed many results that describe how the error can happen.
A Java property “java.rmi.server.codebase” must be set when you want to run the Java program.
What is not clear is that your code base can be pointing to Jar file or compiled classes in the server where “rmiregistry” is run, not where your Java program is running, or alternatively pointing to a HTTP server where your compiled classes or Jar file is installed.
You started your RMI registry in Server A, and you tried to start your RMI server in Server B, and you encountered the above error.
What I noticed is that when I started the RMI server, it is trying to get the RMI stub based on the java.rmi.server.codebase propertyafter binding to the RMI registry. SO java.rmi.server.codebase must be pointing to the filesystem in which RMI registry is run. Alternatively, specify a HTTP url for the compiled classes, or Jar files.
Take note “c:/mycode/classes” must exist in Server A, not Server B where you RMI server is supposed to run.