I am using RMI, where the client is in Windows 2000 and the server is in Linux.

Christopher Schultz

When you push/pull objects over RMI, the RMI mechanish doesn't send then class file with the object - it just serializes it, which includes nothing but the data.

When the server tries to de-serialize the object, it must have the class definition. That's the reason for the ClassNotFoundException that you're getting, and why it clears up when the server has that class file.

You have several options, here:

  • Try to use built-in types for all the objects that you are sending over RMI (like Vector, Hashtable, etc.). Then, you don't have to worry about the clases being there.
  • Have a central repository where all the class files can be found, regardless of the client. Clients will have to send their class files to that central repository before using your RMI server.
  • Have each client bind itself to a local socket, turning the client into a class file server. Have the server turn around and connect to the client to download the class file.
  • Ditch RMI altogether. This is usually hard to do, and still requires you to figure out how to represent your objects without using their original class definitions.

This is a hard problem to solve. I wish you good luck.