This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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 Hello.java HelloImpl.java ) 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.
Regards, Mac ProgrammerNet.org
PhD Artificial Intelligence, OCJP1.6
Joined: Aug 21, 2004
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(RegistryImpl_Stub.java:109 at java.rmi.Naming.lookup(Naming.java:60) at RmiClient.main(MyClient.java:28)