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
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI illegal remote method error" Watch "RMI illegal remote method error" New topic

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
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();
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 �

Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231

check this post it might help

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

Joined: Oct 04, 2007
Posts: 7

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

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

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 �..
wood burning stoves
subject: RMI illegal remote method error
Similar Threads
RMI Security Exception
RMI client failure
RMI Interface
head first rmi error
B&S : Couple of questions