Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

rmi policy

843793May 8 2007 — edited May 13 2007
Hi there,

I am trying to get the RMI tutorial (http://java.sun.com/docs/books/tutorial/rmi/index.html) to work with ClassFileServer (http://java.sun.com/javase/technologies/core/basic/rmi/class-server.zip) as mentioned in the tutorial. The ClassFileServer was instantiated inside the RMI server instead of running one separately. I am currently having a problem with understanding a policy file as I am a newbie in this area. I could get the server running using the following server.policy:
grant codeBase "file:home/ann/src/" {
  permission java.security.AllPermission;
};
grant codeBase "file:/home/ann/public_html/classes/class-server.jar" {
  permission java.security.AllPermission;
};
But as soon as I replace the above with below, I got the following error:
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:{port number} accept, resolve)
grant codeBase "file:home/ann/src/" {
  // The following is needed for name rebind...
  permission java.net.SocketPermission "localhost:1099", "connect, resolve";
};
grant codeBase "file:/home/ann/public_html/classes/class-server.jar" {
  permission java.security.AllPermission;
};
Error stack trace indicated that the following line in ClassServer causes the problem:
socket = server.accept();
My question is why this is possible as I have given all classes in the class-server.jar (ClassServer resides in this jar file) all access to everything (as indicated by line 'permission java.security.AllPermission').

Second question is: how then should the correct server.policy file look like? Any help would be greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2007
Added on May 8 2007
11 comments
149 views