File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes RMI Server problem, errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI Server problem, errors" Watch "RMI Server problem, errors" New topic

RMI Server problem, errors

Siamak Saarmann
Ranch Hand

Joined: Aug 21, 2004
Posts: 78

I am sorry to bring this subject again (lots of people have asked the same thing but I was not able to solve my problem through those threads).

I have this problem with Sun's example. (from API reference)

1- I have compiled java implementaion and interface files ( javac )
2- I have run rmic ( rmic HelloImpl ) and I have my stub and skeleton class files
3- The directory which contains all these files is on my CLASSPATH.
4- I have granted all permissions in my .java.policy
5- I have all 4 files in my directory
6- I have run rmiregistry.exe and it run without any message

Yet I get below error.

I have the same problem with RMI example from the book "Java2 Enterprise Edition 1.4 Bible".

I really appereciate your help.


PhD Artificial Intelligence, OCJP1.6
Siamak Saarmann
Ranch Hand

Joined: Aug 21, 2004
Posts: 78
Hello again.

Sorry. I finally found the problem in SUN's RMI FAQ.

When I started the rmiregistry my codebase was not on my CLASSPATH (as I had created the directory and settings after running the rmiregistry).

By the way I am really really happy of finding this forum. Here seems to be Paradise of java programmers. (I hate SUN's forums as it is very slow and hard to navigate).

I really thank the owner's and people who have made here such a giant java community.


Here is the FAQ:

6.2 If you encounter a problem running your RMI client
The second problem you could encounter is the receipt of a ClassNotFoundException when attempting to lookup a remote object in the registry. If you receive this exception in a stacktrace resulting from an attempt to run your RMI client code, then your problem is the CLASSPATH with which your RMI registry was started. See requirement C in section 6.0. Here is what the exception will look like:

java.rmi.UnmarshalException: Return value class not found; nested exception is:
java.lang.ClassNotFoundException: MyImpl_Stub
at sun.rmi.registry.RegistryImpl_Stub.lookup(
at java.rmi.Naming.lookup(
at RmiClient.main(

Sam Don

Joined: Aug 28, 2004
Posts: 3
Just wondering what IDE were you using ,, or is that done on UNIX , I am struggling getting my stub and skelton created using websphere.
Aster Pan

Joined: Sep 09, 2004
Posts: 1
Well, I met the same problem too.

The message above has helped me with this.

If your OS is windows-based, when you run rmiregistry and your server, the enviornment variable CLASSPATH of both the two consoles must be set to refer your classpath.

I have forgot to set CLASSPATH to the console running rmiregistry before reading this message^^.
I agree. Here's the link:
subject: RMI Server problem, errors
It's not a secret anymore!