GeeCON Prague 2014*
The moose likes Distributed Java and the fly likes Rmi ClassNotFoundException stub Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Rmi ClassNotFoundException stub" Watch "Rmi ClassNotFoundException stub" New topic
Author

Rmi ClassNotFoundException stub

s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 154
hi
I am trying out a simple RMI example given at: http://patriot.net/~tvalesky/easyrmi.html. I have modified anything in it. Now, the issue is that when I run the RMI Server , i get the class not found exception :



Now, I have searched on google, and it seems that normally it is supposed to happen when client doesnt have the STUB file. What I dont understand is, why is it happening at the server end?
Please point out what I am missing.
Thanks
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11465
    
  94

What files do you have in your directory after step 6? On my computer I have:

See that "myRMIImpl_Stub.class" - that is probably what you are missing. Try step 6 again - if there are errors, let us know.

I am assuming you are using an early version of the JDK. Since JDK 5 you should not need stubs.

Personally I would recommend the Oracle RMI Tutorial. Tom Valesky's example does not use good coding conventions, and forces you through some unnecessary hoops.


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 154
Thanks for replying. I am using seperate folders for source and class files. This is what I have in the bin folder of this project:



I know about the RMI tutorial from sun,but this example seems shorter.. the thing is that I had this same issue with my actual project also.. That is why i used this simple example as an experimental stuff, just to see what is possible wrong. And my java version is :



When I use javap in the same bin folder :



how is javap finding the class and java is not?
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

Do you have all the classes on both the client and the server side?

Then doing an RMI call, you do not actually send the class over to the other side, only the information about what and how to trigger it. If the receiver doesn't have the class that is supposed to be called in the classpath, then it is hard to find it.
s ravi chandran
Ranch Hand

Joined: Dec 20, 2010
Posts: 154
actually in this folder I have everything related with this sample example, the client and the server code and the stub file.. I am trying to run this first and then I will move on to making it work remotely. But the error at server end is just confusing. The client side doesnt even come into the picture, unless the server runs perfectly( locally first).

Then doing an RMI call, you do not actually send the class over to the other side, only the information about what and how to trigger it


How to do that? Will the syntax change for this?
Harshal Mekhale
Greenhorn

Joined: Sep 17, 2011
Posts: 4
its either due registry issue or rmic compatibility.first try manually i.e by starting rmiregistry if it fails then try programatically. and while generating stub and skel files use
"rmic -vcompat" command
 
GeeCON Prague 2014
 
subject: Rmi ClassNotFoundException stub