GeeCON Prague 2014*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Generating RMI Stub for Java 1.4.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Generating RMI Stub for Java 1.4.2" Watch "Generating RMI Stub for Java 1.4.2" New topic
Author

Generating RMI Stub for Java 1.4.2

Neo Say Bin
Greenhorn

Joined: May 19, 2008
Posts: 7
Hi,

I'm working on my project using Eclipse 3.3.2, Java 1.4.2. Mu project is based on Java 1.4.

I've been reading the forum pages but I'm still not too sure how to generate the RMI stub. I tried to run "rmic -d <class name>" on the command prompt but it fails. Anyone can provide more detailed instructions?

Sorry abt this question. I'm not too sure abt RMI since I've not had any experience with it.

Thks a lot for the help. Rgds.
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Hey, partner.

You can't use this JDK, or you'll fail
In your assignment, you can find this statement:

"You may develop your code using any implementation of the Java 2 platform, but the submission that you return must have been tested and shown to work under a production (not development) version of the Sun Microsystems' Java 2 platform and that platform must not have been superseded by a new production version for more than 18 months by the time you make your submission."

And also, please take a look at this page: J2SE Code Names.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Neo Say Bin
Greenhorn

Joined: May 19, 2008
Posts: 7
thks for the reminder nearly forgot abt it.

btw, found a useful Eclipse plugin to generate RMI stub:

http://www.genady.net/rmi/v20/docs/builder/index.html
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Hey partner. Sorry for not effectively answering your question it's just that, for my server, I did not generate any stub all I have is an interface that extends Remote, and in the implementation, I call UnicastRemoteObject.exportObject.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11464
    
  94

My reading of the requirements for using a recent JDK is that you are allowed to use JDK 1.4 for development purposes, as long as you verify that it works with JDK 6 (or later if 7 comes out) before you submit it.

Personally I recommend against this though, as there is also the requirement that "Use of functionality provided by the core Java classes will be preferred to your own implementation of that functionality" - if you are not using the latest JDK for development, then there is a greater chance of you developing your own solution for some class or method that exists in the later JDK.

Originally posted by Roberto Perillo:
... I did not generate any stub ...

From the instructions I received (yours may be different):
You must provide all classes pre-installed so that no dynamic class downloading occurs.

If you have not generated stubs, and you are using JDK 5 or later, then they will be dynamically generated and dynamically downloaded.

Personally I think that this is not checked for by the assessors. But I would not want to take the risk.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Hey, Andrew.

I didn't exactly understand what they really meant by this requirement, you know... I thought that it was just telling us not to use codebase in RMI, you know... and also, since the code that would be downloaded from the server would already be in the runme.jar file, I thought it would be ok.
Anyway, let's see what happens now.
Neo Say Bin
Greenhorn

Joined: May 19, 2008
Posts: 7
Thks for the replies.

I have a question on java.net.ConnectException:

I used the RMI Eclipse Plugin mentioned above to generate the RMI stubs to fulfil the project requirements.

When I tried to run my application in network client mode for the 1st time, the following exception was generated:

WARNING: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
/* More description */

Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
/* More description */

I used the Apress "SCJD Exam With J2SE 5" textbook example as a basis for my application development. When I tried to run the textbook example under network client mode, I get the same exception.

I found some discussions on this topic in the forum:
http://www.coderanch.com/t/188952/java-developer-SCJD/certification/RMI-connection-exception

But I'm not quite sure what it means. Can anyone provide some guidance on this issue?

Thks a lot for the help.
mohamed sulibi
Ranch Hand

Joined: Sep 04, 2005
Posts: 169
hi Neo Say Bin;

Simply in the scjd book you can find the command that generate stub class as follow :
rmic [name of the remote class]
ex: "rmic com.apple.cat.clock.WelcomeRemote"
for your command: rmic -d .. here -d is used to specify where to put the generated stub class.
complete example:
the remote class found on : c:\project\build\com\apple\cat\clock\WelcomeRemote.class
and defined in this class package as follow: package com.apple.cat.clock;
so the codebase is "c:\project\build\."
go to code base folder : c:\project\build\"
and issue the above command: "rmic com.apple.cat.clock.WelcomeRemote"
and after that you will see the WelcomeRemote_stub.class in the same folder:
"c:\project\build\com\apple\cat\clock"
Neo Say Bin
Greenhorn

Joined: May 19, 2008
Posts: 7
Hi,

I used the RMI Eclipse plugin to generate the RMI stub and the stub files are found in the "remote" folder.

I'm trying to execute the application using Eclipse 3.3, Java SDK 5, Windows OS, no firewall.

So not too sure why I can't execute the application in the network client mode.

Thks in advice for help rendered
mohamed sulibi
Ranch Hand

Joined: Sep 04, 2005
Posts: 169
hi;

i add my notes just for information about how can you generate the stub anyway;

for your problem i think you must check if the PORT number on rmi server is equal the port number the clinet connect to

regards.
 
GeeCON Prague 2014
 
subject: Generating RMI Stub for Java 1.4.2