File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI illegal remote method error

 
Naveen Narayanan
Ranch Hand
Posts: 114
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 �
 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

check this post it might help
 
Naveen Narayanan
Ranch Hand
Posts: 114
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 114
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 �..
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic