Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with RMI (ServerException)

 
Christopher Button
Greenhorn
Posts: 14
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day,

I was hoping with a quick glance over this code someone might be able to elucidate the problem I seem to be having in getting my client side to correctly invoke methods on the RMI stub.

I have set it up according to Andrew Monkhouse's design (Factory pattern) but am getting the below error whenever I try to run the client after running the server.

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\IT>java -jar c:\scjd\dist\scjd.jar

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:

java.rmi.server.ExportException: remote object implements illegal remote interface; nested exception is:

java.lang.IllegalArgumentException: illegal remote method encountered: public abstract long suncertify.db.DB.lock(int) throws suncertify.db.exceptions.RecordNotFoundException

java.lang.NullPointerException

Exception in thread "main" java.lang.NullPointerException
at suncertify.gui.Client.setTable(Client.java:69)
at suncertify.gui.Client.<init>(Client.java:49)
at suncertify.gui.AppLoader.<init>(AppLoader.java:22)
at suncertify.gui.AppLoader.main(AppLoader.java:17)


All the necessary methods throw RemoteExceptions.

More information may be needed from me to clarify things, but what I'm really after is an understanding of what the general issue is here, as far as "illegal remote method" and "illegal remote interface" are concerned. They are coded as per Monkhouse's design.

The issue with the Lock method is baffling above all, since I haven't yet invoked it at all, anywhere, and it is only one of the methods in the DB interface. I can't understand why it is being singled out.

I don't want to paste large swathes of code, so if any specific information is further needed, please let me know and I will try and explain in more detail what is required.

Any general conceptual help would be most appreciated.

Thank you,

Chris
 
Himai Minh
Ranch Hand
Posts: 1316
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, this is not the right forum for SCJD exam. You may want to move it to the right forum.

It seems to me that the Dvd.db file is missing.
Maybe, try to un-jar the files, make sure the Dvd.db is in the current working directory and run the main methods and see.
 
Christopher Button
Greenhorn
Posts: 14
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't believe I posted this in the wrong forum. Sorry about that. Could a moderator move this to the correct location?

Also, I rewrote my RMI code to fit the Adapter pattern, rather than the Factory pattern. It seems all is working well now.

Thanks for the help in any case!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic