• 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

rmic unnecessary for SCJD project?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am an RMI newbie and am testing out the ComputeEngine example in the RMI trail of Sun�s Java Tutorial. I have made several modifications to the example code in conformance with the following SCJD project guidelines:

� You must not require the use of an HTTP server.
� You must not require the installation of a security manager.
� You must provide all classes pre-installed so that no dynamic class downloading occurs.
� You must use RMI over JRMP (do not use IIOP).

I compiled the whole application using javac only (no rmic) and copied the resulting directory structure to another computer on the same network.

At this point, I did not expect the application to work propery because I had not run rmic. I decided to try it out to see what sort of errors might occur. I first tried to start the client on machine A and got a java.net.ConnectException: Connection refused. I figured that�s expected given that the server had not been started.

I then started the server on machine B. It ran without error even though I had not run rmic. I checked netstat and saw that it was listening on the port I specified.

After starting the server on machine B, I went back to machine A and ran the client again� it ran the application with expected output!

Why is my program running as an RMI application without ever compiling it using rmic? I am guessing that stubs are unnecessary as long as all of the classes are available on both client and server to prevent dynamic loading. However, it seems that many posters on this forum are using rmic despite the explicit project requirement to avoid dynamic loading. Are they taking extra steps or am I missing something? I am worried that my configuration is a special case and a similar build might flop for the exam graders�

Thanks in advance!
[ April 01, 2005: Message edited by: Dan Jones ]
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you use Java 5 ? Since that version, rmic is not longer needed to be invoked explicitly, the stubs will be generated on the fly.
 
Dan Jones
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! I do use Java 5 and have found the official release from Sun:
http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html

The first sentence tells most of the story:

�This release adds support for the dynamic generation of stub classes at runtime, obviating the need to use the Java(tm) Remote Method Invocation (Java RMI) stub compiler, rmic, to pregenerate stub classes for remote objects.�

Now if only they would update the Java Tutorial... Has anyone seen any good, up-to-date RMI tutorials with examples on properly coding solutions that don�t make use of dynamic downloading?
[ April 04, 2005: Message edited by: Dan Jones ]
reply
    Bookmark Topic Watch Topic
  • New Topic