jQuery in Action, 3rd edition
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Does the client RMI object need to extend Remote? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Does the client RMI object need to extend Remote?" Watch "Does the client RMI object need to extend Remote?" New topic

Does the client RMI object need to extend Remote?

Lara McCarver
Ranch Hand

Joined: Dec 09, 2003
Posts: 118
Does the object which the client gets from the RMI Naming server need to extend Remote? I thought that because this application uses RMI, any method could run into a communication problem (e.g. the network could go down) and end up throwing a RemoteException. Therefore, the RMI object which the client uses should implement Remote, and each of its methods, including the constructor, would throw a RemoteException.

But in the book SCJD, the DBClient interface does not implement Remote. I looked at the sample code, and it just looks like this:

So... does the object which the RMI Naming server return actually need to implement the Remote interface?
Samuel Pessorrusso
Ranch Hand

Joined: Jul 21, 2005
Posts: 164
Read the Sun's tutorial
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11778

Hi Lara,

Whenever a book like that is written, the author has the problem of wanting to provide all the information necessary to pass the exam, but without giving away a complete solution. One of the best ways to do this (IMHO) is to provide the answers in separate chapters, then do something slightly different in the example project so that the example project's code can't be copied and pasted.

In Max's book (and in the second edition) we describe that RemoteException must be declared to be thrown in methods that will be called remotely in the chapter on RMI. However we then deliberately do something slightly different in the sample assignment by having all DBClient's methods throw IOException, which is the superclass of RemoteException.

In the second edition we have dedicated several paragraphs to describing what parts of our sample assignment are deliberately harder than the real assignment, and which parts are deliberately easier.

Regards, Andrew

The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
I agree. Here's the link: http://aspose.com/file-tools
subject: Does the client RMI object need to extend Remote?
It's not a secret anymore!