aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes policy file 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 "policy file" Watch "policy file" New topic
Author

policy file

Sam Jason
Greenhorn

Joined: Apr 09, 2002
Posts: 6
I use RMI in my design and create two policy file for client side and server side.
here are the client side policy file:

grant {
permission java.net.SocketPermission "*:1024-65535","connect,accept";
permission java.io.FilePermission
"c:\\server\\exported_classes\\-", "read";
permission java.io.FilePermission
"c:\\client\\exported_classes\\-", "read";
};

here are the server side policy file:

grant {
permission java.net.SocketPermission "*:1024-65535","connect,accept";
permission java.io.FilePermission
"c:\\server\\suncertify\\db\\-", "write";
permission java.io.FilePermission
"c:\\server\\exported_classes\\-", "read";
permission java.io.FilePermission
"c:\\client\\exported_classes\\-", "read";
};

It seems that client must know where the server located its exported classes and the server must know where the client will put the exported classes, right? and it seems I have to setup this way to run the program correcly.
whether I misunderstood sth?
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
If you package your server and client into two seperate executable jar files you will need to include the _stub classes in the client jar file.
The stub classes are not being dynamically loaded as we can not presume the server machine is running an http server.
I only used a policy file on the server side, as I thought that it was wise to specify exactly which ports and file a client could access. On the client side I didn't see this as necessary.
I did however lose two points on general considerations but believe that was because I didn't include a clean shutdown method for the server which I lost four points on.
 
Consider Paul's rocket mass heater.
 
subject: policy file