RMI Pitfalls and Problems

In this post, I plan on laying out multiple common problems with RMI, that a developer can run into.  I hope that this will be a concise guide to fixing the common RMI problems that beginners run into.  As I come up with more, I will edit this post, rather than creating a new one.  I will then post a comment on this entry; if you are subscribed to the comments (RSS feed), you will get notification when there is an update.

Also, if you are having some sort of RMI trouble, post a comment, and I will let you know if I know the solution.  I may also add the solution directly to this post, if it happens to actually be an RMI related issue.

no security manager: RMI class loader disabled

This is a very common error, and can be a result of various things.  Generally speaking though, it is a result of a class not being accessible to the client machine, that is accessible to the RMI server.  A common developer mistake, is to nest Exception1  inside Exception2, and throw Exception2 to the client.  The client JVM knows nothing about Exception1, and therefore the above message is displayed, with more details as follows.

Caused by: java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
 java.lang.ClassNotFoundException: com.example.myapp.Exception1 (no security manager: RMI class loader disabled)

The solution to this problem is to either not wrap Exception1, to be propagated to the client side, or to make sure the proper jars are in the CLASSPATH of the client side.