• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Where's that _skel.class file?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to generate stub and skeleton files for my remote service, but all I'm getting is the stub file. I know that there's some option to not generate skeleton files, but I'm just using plain

command with no options.

Can anyone please help me figure this out? Do I need that skeleton file at all to run the service? (I believe I do, but who knows, maybe there were some changes made to the whole RMI thing in the last version of Java...)
[ November 11, 2008: Message edited by: Slava Golovachenko ]
 
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
Skeleton classes are not required since java 1.2. Infact since java 1.5 stubs are also not required. RMI uses dynamic proxies to create stubs on the fly.
Here�it is mentioned on the release notes.
 
Vopli Vidoplyasova
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! That's what I suspected. It's weird though in Sun's Java manuals it's still said both are generated, as well as in Head First Java 2nd edition (covering Java 1.5).
One more question. You say the stub file is not necessary anymore. How come I'm getting an error when running client side part of the app without the stub file in the same directory? Do I need to make any changes to the app in order for it to work without stubs?
 
Nitesh Kant
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
Dynamic proxies will be used as stub if your remote object extends UnicastRemoteObject or it is exported using the static exportObject() method therein.(See release notes that i linked to earlier)
How are you exporting your server and what is the excpetion you are getting at the client side?
Is your client also on jdk 1.5?
[ November 12, 2008: Message edited by: Nitesh Kant ]
 
Vopli Vidoplyasova
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the latest version of JDK and in fact the whole thing is running on one machine, I wrote a simple app that converts gas price in dollars per gallon to [other currency] per liter just to learn RMI. Here's what I get when no stub is present in the same directory as client.class (when it's there everything runs great):

Here's the code for my service .class file:

Here's the client part (no GUI stuff in this version to keep it simple):

Of course there's also that remote interface file, but nothing interesting in there.

Thanks!
[ November 12, 2008: Message edited by: Slava Golovachenko ]
 
Nitesh Kant
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
You do not have the Interface definition in the client.
Dynamic proxies require the interface definition. What RMI says is that the stub classes need not be there at the client/server. However, the interface definition has to be present or dynamic code downloading must be enabled. This is what that error is telling you.
 
Vopli Vidoplyasova
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I'm not sure if it was what you're talking about or something else, but I recompiled the whole thing again, ran rmiregistry and the service (which of course I did before as well) and everything worked. I also created the GUI version of the app (all RMI stuff is same) and it works perfectly. Go figure...
Anyway, thank you for answering my posts!
 
Nitesh Kant
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
Thats great to hear!
If you are learning RMI then I would suggest you to go back and take a stall of things and understand why it was not working before and why it worked now. It will help you.

My understanding is that the remote interface (GasPriceConverter) must be available with the client or Dynamic class downloading must be enabled at the server for things to work. If you feel that it is working even without this definition being at the client then there is something that you need to dig deep in.
 
reply
    Bookmark Topic Watch Topic
  • New Topic