aspose file tools*
The moose likes Distributed Java and the fly likes The RMI API isn't finding my classes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "The RMI API isn Watch "The RMI API isn New topic
Author

The RMI API isn't finding my classes?

Aaron Ballard
Greenhorn

Joined: Jun 18, 2009
Posts: 7
I'm writing a Java server application, which I have decided to make use an extra fancy distributed model using Remote Method Invocation so the different parts can talk to each other. I read a tutorial on it, wrote an application, and compiled it. Everything worked up until I ran the part of the server that contained the RMI server code.

It seemed to be starting up properly, then died in a glorious puff of stack trace:

I was confused as heck when I first saw this. I could see the class file it said didn't exist, but I could see it in my code directory, plain as day. That's when I discovered that it didn't compile my remote interface into stub and skeleton files. In the past, you had to use the RMI compiler to manually generate these files, but it's supposedly automatic now. So why didn't it do it?! Is it having trouble identifying my interface as a remote interface?

That's got to be it as far as I can tell. Here's the code for the interface which was supposed to generate stub and skeleton files:
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

"Just another programmer"

Please click the "My Private Messages" link (at the top of this page) for a message from JavaRanch.


[My Blog] [JavaRanch Journal]
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Aaron and welcome to Javaranch!

What JDK are you using? Are you writing EJB's or POJOs with remoting?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Aaron Ballard
Greenhorn

Joined: Jun 18, 2009
Posts: 7
Martijn Verburg wrote:Hi Aaron and welcome to Javaranch!

What JDK are you using? Are you writing EJB's or POJOs with remoting?

I'm using what I'm pretty sure is the latest JDK (1.6u13) and I'm just writing POJO's, I'm not even using a real IDE.

A message to Pai: I can understand you wanting me to change my name, but why did you modify my topic name? Really, that's pretty dull.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Are both the server and the client running on JRE 1.6 and were compiled by JDK 1.6 for a 1.6 environment (just double checking).
Aaron Ballard
Greenhorn

Joined: Jun 18, 2009
Posts: 7
Martijn Verburg wrote:Are both the server and the client running on JRE 1.6 and were compiled by JDK 1.6 for a 1.6 environment (just double checking).

Yep yep yep! I'm guessing this isn't one of those "simple solution" kinda things, huh?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

vaguely useful post here, not sure apart from that, maybe you should try the explicit creation using the rmi compiler?
Aaron Ballard
Greenhorn

Joined: Jun 18, 2009
Posts: 7
Martijn Verburg wrote:vaguely useful post here, not sure apart from that, maybe you should try the explicit creation using the rmi compiler?

I was originally going to try using the compiler manually as you said, but it seems that it was removed from the JDK after it was integrated into the main compiler, because it's not in my JDK bin directory.

Also, I'll check out that posts. Thanks for the help.

Edit: Never mind, the rmic compiler is there. I was really tired and accidentally looked in the JRE bin directory instead.
Aaron Ballard
Greenhorn

Joined: Jun 18, 2009
Posts: 7
Well, I successfully used the rmic utility to generate the stub and skeleton files, but now it's just doing the same thing but with the stub class.

The server class references other classes and finds them just fine, but for some mysterious reason, the RMI api is not finding the classes. I swear this looks like it's not checking my classpath for the classes...

I've really had no end of misery with RMI... This is like, my third nightmare with it. Maybe I'll just use sockets for communication instead... They've got to be less resource-hungry too...
Aaron Ballard
Greenhorn

Joined: Jun 18, 2009
Posts: 7
Come on, there has got to be someone who knows what's going on...
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

In order to utilize the dymanic proxies your server needs to extend UnicastRemoteObject.
does not use the dynamic proxies as specified here

The exception suggests that the rmi registry where you are binding the server is not finding the stub classes.
You either need to enable dynmaic class downloading or put stubs and interfaces in the RMI Registry classpath OR start the registry programatically using LocateRegistry in the same java app that starts the server.


apigee, a better way to API!
Aaron Ballard
Greenhorn

Joined: Jun 18, 2009
Posts: 7
Nitesh Kant wrote:In order to utilize the dymanic proxies your server needs to extend UnicastRemoteObject.
does not use the dynamic proxies as specified here

The exception suggests that the rmi registry where you are binding the server is not finding the stub classes.
You either need to enable dynmaic class downloading or put stubs and interfaces in the RMI Registry classpath OR start the registry programatically using LocateRegistry in the same java app that starts the server.

Awesome! Someone who seems to know what they're talking about! I'll look into everything you just said and get back to you!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: The RMI API isn't finding my classes?