• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The RMI API isn't finding my classes?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Just another programmer"

Please click the "My Private Messages" link (at the top of this page) for a message from JavaRanch.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aaron and welcome to Javaranch!

What JDK are you using? Are you writing EJB's or POJOs with remoting?
 
Aaron Ballard
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
vaguely useful post here, not sure apart from that, maybe you should try the explicit creation using the rmi compiler?
 
Aaron Ballard
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Come on, there has got to be someone who knows what's going on...
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Aaron Ballard
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic