Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SCJD Exam with J2SE 5 book - RMI Question.

 
Annie McCall
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I just started to prepare for the SCJD exam and purchased SCJD Exam with J2SE 5 ( second edition). I downloaded the source for DennyDVD project and now I'm reading about Networking with RMI (chapter 6). The book says to run the RmiNoFactoryExample and RmiFactoryExample (p. 182). When I try to run it I get the following error:

C:\mccalla\java\DennyDvd\classes>java sampleproject.remote.RmiNoFactoryExample
Exception in thread "main" java.rmi.RemoteException: . (Access is denied); neste
d exception is:
java.io.FileNotFoundException: . (Access is denied)
at sampleproject.remote.DvdDatabaseImpl.<init>(DvdDatabaseImpl.java:53)
at sampleproject.remote.RmiNoFactoryExample.main(RmiNoFactoryExample.jav
a:43)
Caused by: java.io.FileNotFoundException: . (Access is denied)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(Unknown Source)
at java.io.RandomAccessFile.<init>(Unknown Source)
at sampleproject.db.DvdFileAccess.<init>(DvdFileAccess.java:94)
at sampleproject.db.DvdDatabase.<init>(DvdDatabase.java:69)
at sampleproject.remote.DvdDatabaseImpl.<init>(DvdDatabaseImpl.java:51)
... 1 more


Can anyone tell me what I missed? I am just beginning to study and want to be able to at least follow the examples in the book.

Thanks.
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The rmi factory is used to create data access object, this object purpose is to access the database and for the database you need a file.

Regards
M
 
Annie McCall
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mihai for your reply. It really help me find my solution.

I will post my solution in case any newbies like me run into the same thing. This might have been obvious to others (but not me) and it could of said to do this in the book (and I missed it) but I had to change the code in both RmiNoFactoryExample and RmiFactoryExample classes.

I made the changes below in the main method in both classes:

RmiFactoryExample:
From....
Naming.rebind("RmiFactoryExample", new DvdDatabaseFactoryImpl("."));
To.....
Naming.rebind("RmiFactoryExample", new DvdDatabaseFactoryImpl("./dvd_db.dvd"));

RmiNoFactoryExample:
From....
Naming.rebind("RmiNoFactoryExample", new DvdDatabaseFactoryImpl("."));
To.....
Naming.rebind("RmiNoFactoryExample", new DvdDatabaseImpl("./dvd_db.dvd"));


After I made these changes and recompiled, programs worked exactly like they said they should in book (Chapter 6 pg. 182)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic