Todd O'Bryan <email@hidden> writes:
The weird thing is that ServerImplementation_Stub.class is right
there inside the same folder as StartServer.class and
ServerImplementation.class, so I can't understand why the ClassLoader
can find them and not it. I have this problem both when I run from
inside Eclipse using the RMI Plugin, but also when I run from the
command line.
Any ideas?
are you using a pre-1.5? things have changed in 1.5 in ways that I'm
not completely familiar with (you don't need to run a separate stub
compiler, for one thing), but I might still be able to help.
there are two JVMs involved here: your server and the RMI registry,
into which you're trying to bind a reference to your server. it's the
registry that's complaining about not being able to load the class.
probably when you started the registry you didn't set its CLASSPATH to
something containing the stubs. which is normally exactly what you'd
want to do.
much more about this can be found here:
http://java.sun.com/j2se/1.5.0/docs/guide/rmi/codebase.html
one of the features of RMI I didn't mention previously was "code
downloading". RMI can arrange for java classes to be downloaded
from somewhere to the client prior to being executed. typically you'd
do this with the stubs. that is, rather than packaging the stub
classes with the client, you'd allow the client (the RMI runtime on
the client) to download the classes at runtime.