I’m trying to run the sample code from this Sun tutorial:
http://download.oracle.com/javase/6/docs/technotes/guides/rmi/hello/hello-world.html
I’ve copied all their code exactly into an Eclipse project and run ‘rmiregistry &’ from terminal (I’m running OSX).
When I try to run the server, I get
Server exception: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: suntut.Hello
I have been assured by #java on freenode that the registry itself does not need to know anything about my classes. But it seems even stranger that the issue is with my filenames or something — all three classes see each other just fine at compile time, they are all in the same package in an Eclipse project, etc. Can anyone help me start diagnosing this?
Update:
I tried running it from the command line as well. From /Users/[me]/workspace/[Projectname]/testing/ I ran
java suntut/Server
and got the exact same error. (This is after successfully compiling everything with javac)
If this is your first time with RMI, I’d recommend following the instructions to the boot without changing anything (i.e. not even the package name). This makes it simple for others to help you out and the chances of you making a mistake are low.
For the time being, do away with Eclipse and try following the instructions in the tutorial. Using an IDE, you’ll end up mixing IDE and the real issues. That being said, you have to use the fully qualified class name when running a Java class. If testing is part of the package name, you have to use
testing.suntut.Serverinstead of justsuntut.Server.