aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI illegal remote method error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI illegal remote method error" Watch "RMI illegal remote method error" New topic
Author

RMI illegal remote method error

Naveen Narayanan
Ranch Hand

Joined: Sep 11, 2007
Posts: 114

Please find the RMI error here
-----------------------------------------------------------------
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
ed by: java.lang.IllegalArgumentException: illegal remote method encountered: public abstract java.lang.String[] suncertify.db.DBAccess.readRecord(long) thr
suncertify.db.RecordNotFoundException
at sun.rmi.server.Util.checkMethod(Unknown Source)
at sun.rmi.server.Util.getRemoteInterfaces(Unknown Source)
at sun.rmi.server.Util.getRemoteInterfaces(Unknown Source)
at sun.rmi.server.Util.createProxy(Unknown Source)
... 21 more
ption in thread "main" java.lang.NullPointerException
at suncertify.gui.MainWindow.<init>(MainWindow.java:150)
at suncertify.gui.ApplicationRunner.<init>(ApplicationRunner.java:56)
at suncertify.gui.ApplicationRunner.main(ApplicationRunner.java:29)
-----------------------------------------------------------------

RMI connection throws a NullPointerException at
(DBAccess) factory.getClient();
and
IllegalArgumentException at readRecord(long)

readRecord at DBAccess interface is
public String [] readRecord(long recNo)
throws RecordNotFoundException;

I implemented readRecord in class Data and well able to call the functionalities in standalone mode�

Is there any issues with Serialization here probably with the long value I am passing and the String[] array I am getting back �

Or I am missing something else �
Could anybody please throw some light here �


SCJP 5.0, SCJD, SCWCD
Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
hi,

check this post it might help


SCBCD - SCWCD - SCJD - SCJP - OCA
Naveen Narayanan
Ranch Hand

Joined: Sep 11, 2007
Posts: 114

Thanks for that , it was helpful

It seems the reason was in the Adapter for RMI , I didn�t throw RemoteException for
Exposed methods for communication �

Now another difficulty arises RecordNotFound exception and RemoteException are incompatible �
Amy Young
Greenhorn

Joined: Oct 04, 2007
Posts: 7
Hallo

Are you calling the readRecord() method from the Remote package directly to the DBAccess interface??
Because this is what I did and cause lots of problems. The way I solved it is described in : http://www.coderanch.com/t/189390/java-developer-SCJD/certification/RMI-Factory-implementation-fails

Good luck

Amy
Naveen Narayanan
Ranch Hand

Joined: Sep 11, 2007
Posts: 114

Thanks again
Seems RemoteAdapter is now handling things and returning �
Probably I stuck up here

Data interface has
---------------------
public String [] readRecord(long recNo)
throws RecordNotFoundException
Remote interface has

public String[] readRecord(long recNo) throws RecordNotFoundException,RemoteException

RecordNotFoundException
public class RecordNotFoundException extends RuntimeException
{

So probably , the remote interface method can�t override the Data interface method since RemoteException is not a subclass of RecordNotFoundException

might have to go for an alternative ...

Am I thinking right way that make sense �..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: RMI illegal remote method error
 
Similar Threads
RMI Interface
B&S : Couple of questions
RMI Security Exception
head first rmi error
RMI client failure