Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

access denied java.io.FilePermission

 
Mari Wessels
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I'm trying to get my RMI to work. I have a policy file which grants all permissions, looks like this:
grant codeBase "http://marie:1099/Developer/scjd/starting/-" {
permission java.security.AllPermission;
permission java.io.FilePermission "<<ALL FILES>>", "write, read, delete, execute";
permission java.security.SecurityPermission "getPolicy";
permission java.security.SecurityPermission "setPolicy";
permission java.io.SerializablePermission "enableSubclassImplementation";
permission java.io.SerializablePermission "enableSubstitution";
permission java.net.SocketPermission "marie:1099-", "accept, connect, listen, resolve";


};
It sits in my jdk bin, yet I still get a write exception, saying I don't have access to write. The file exists and I can read it, but I can't write to it (tested for that.)
Anybody have any ideas? I'm pretty desparate here!!!
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mari,

grant codeBase "http://marie:1099/Developer/scjd/starting/-" {
permission java.security.AllPermission;
permission java.io.FilePermission "<<ALL FILES>>", "write, read, delete, execute";
permission java.security.SecurityPermission "getPolicy";
permission java.security.SecurityPermission "setPolicy";
permission java.io.SerializablePermission "enableSubclassImplementation";
permission java.io.SerializablePermission "enableSubstitution";
permission java.net.SocketPermission "marie:1099-", "accept, connect, listen, resolve";

};

If you want your policy file to grant full permission why don't you just do this:



It sits in my jdk bin, yet I still get a write exception, saying I don't have access to write. The file exists and I can read it, but I can't write to it (tested for that.)

How does your application know to use it? You should include it on the command line like this:

Hope this helps,
Michael Morris
 
Mari Wessels
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! Removed the codebase line from the policy file and it worked a charm.
Mari.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic