I have been searching all over the Internet, but I can't find a way to get the RMI code to behave the way I want (like an RPC call).
Java: 1.5
I am trying to set up a client/server RMI call - the client should call the "square()" method on the server, the server squares the number that's passed, and returns it.
During the process of building this, I put a log4j statement on the server method.
When I try to run the client from the command line, I look up the name in the RMI registry, execute the square() method on the local instance, and get a "NoClassDefFoundError" for log4j on the client as it attempts to run the square() method.
What this is telling me is that the client is attempting to download not only the interface, but the implementation of the server logic as well. Which, for the situation I'm in, is not what I want.
I've looked and looked, and I can't find an obvious answer for how I should get the system to run the methods remotely, like an RPC call.
I discovered the problem - my server implementation was not extending UnicastRemoteObject. Apparently this causes the RMI server logic to send the client a copy of the server implementation code, instead of a stub representation of the server implementation code.