File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: RMI & Lock Questions 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 "B&S: RMI & Lock Questions" Watch "B&S: RMI & Lock Questions" New topic
Author

B&S: RMI & Lock Questions

Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Hi all and good day

I'm testing my solution for release , but, I have some question...

RMI
If I start my Server on localhost, and then, I start the Client on localhost, all works correctly...
BUT...If I start Server on others PC (some lan), and then, I start the Client on localhost (points on Server) I receive a SecurityException
The Sun specification say don't use ANY Security Manager...
What does this mean?

Lock
I can bring in available ONLY one instance to my database... I specific...
If I start a Server and 2 Client, the lock work correctly... BUT, I start a standalone Client (when Saver is up), and point same database, the previous lock (managed by Server), can't accessible...
The Lock management must be persists between same application runs???
Is possible run more Clients in standalone mode and access to same database???

Thanks, Laura





Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5597
    
  15

Hi Laura,

Regarding your question about running a standalone client while the server is also running. I have the following in my assignment:

You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.


So that's a scenario that should not happen!

Regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2268
    
    3

Howdy, Laura!!!

I'm testing my solution for release


Awesome!

Let me just see if I understood correctly... are you able to start your server and connect to it from another machine, providing the server's IP address? Are you able to start your server and connect to it from the same machine, providing the IP 127.0.0.1?

For the lock question, you may assume that if you start the application in standalone mode in a machine where the server is already running, one thing should not interfere with the other... so, the locking mechanism of the standalone mode is one thing, and the locking mechanism of the server is another thing.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Hi Roberto,

Ok, about RMI...
If I start Server & Client on same machine (127.0.0.1) all work correctly...
When start Server on 192.168.xxx.yyy and the Client on 127.0.0.1 (but hook the server on 192.168.xxx.yyy) I gets a SecurityException

For Lock... I solve with locking the database file... I assume the only one instance on database is available (Server or Client)

Hi... Laura
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2268
    
    3

Hey, Laura.

It's kindda' hard to tell what can be wrong with your server, but please take a look here and see if it helps. If it isn't of much help, then please take a look here. I advised many people to follow this tutorial during the server development. I know this works because I followed it when I created my server
Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Thanks to all (especially Roberto Perillo)

For RMI I solve the problem... make an error during the declaration (lookup) the server

Hi, Laura
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S: RMI & Lock Questions