Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMIC On 5.0 Exam?

 
Rod Hilton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've seen a lot of people talking about RMIC and RMI here. I've finished my project for the SCJD exam, but I'm not sure I did things right with rmi.

I'm not sure what is involved with RMI "Dynamic Downloading". Here is what I'm doing in order to get the class I want to use.

this.registry = LocateRegistry.getRegistry(Config.getRemoteHost(), Config.getRemotePort());
this.dhs = (DBServer) (this.registry.lookup("DataHandlerServer"));

Here is all I'm doing to make it available in the server app:

this.registry = LocateRegistry.createRegistry(Config.getRemotePort());
this.registry.bind("DataHandlerServer", new DBServerImpl());

Does this use dynamic downloading? I'm taking the SCJD 5.0 exam - is what I've done against the rules? Am I supposed to use RMIC instead? If so, what's a good way of testing that my application is using my stubs rather than auto-generated stubs?

Thanks.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rod,

Your code does not indicate whether you are using dynamic downloading or not - in both cases the code is identical.

However, you are indicating that you have not used the rmic compiler. This means that at runtime the server JVM must generate the stub files, which must then be dynamically downloaded by the client JVM(s).

This fails the requirements of the assignment. I specifically double checked this with Sun when writing my book, and received confirmation that this can result in automatic failure.

To meet the assignment requirements, you must use rmic, and then include the generated stubs within your runme.jar file - the client JVM will not download the stubs if they are already available locally.

Regards, Andrew
 
Luc Feys
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forgot to use rmic on my scjd submission and scored 0 for network server. I passed, so no automatic failure in my case. But I feel pretty lame for losing marks for such a stupid mistake. Could have been a lot worse.

So my message to the forum is:

DO NOT FORGET TO USE RMIC WHEN USING JAVA 5

Cheers.
 
Mike Ngo
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However, you are indicating that you have not used the rmic compiler. This means that at runtime the server JVM must generate the stub files, which must then be dynamically downloaded by the client JVM(s).


This is not true. If the stub is not pre-generated, you get back a proxy instead of a stub.

Object o = this.registry.lookup("DataHandlerServer");
System.out.println("lookup result: " + o);
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which is downloaded and serves as the stub...
 
Mike Ngo
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which is downloaded and serves as the stub...



Are you saying that the class java.lang.reflect.Proxy is downloaded?



Are you saying that the class java.lang.String is downloaded?

Both classes are in rt.jar. Show me where is the class downloading.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic