Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error RMI

 
Paolo Scire' Scappuzzo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI, this is my problem: i create myJava.policy that contains:

grant { permission java.security.AllPermission "", "";};
grant { permission java.net.SocketPermission "*:1099-", "listen, accept, connect, resolve"; };
grant { permission java.util.PropertyPermission "*", "read, write"; };
grant { permission java.io.FilePermission "*", "read, write"; };

i still do:

-Djava.rmi.server.codebase=file://bin/
-Djava.security.manager
-Djava.security.policy="myPath/myJava.policy"

but it give me this error :
Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "\\bin" "read")

why? In myJava.policy there's: grant { permission java.io.FilePermission "*", "read, write"; };, someone can help me? Thanks.
 
Paolo Scire' Scappuzzo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved, but i have another question for you. When i write:

System.getProperties().setProperty("java.security.policy", mypolicy);
System.setSecurityManager(new SecurityManager());

these 2 statements must be written as above or i have to reverse their? Because setProperty checks if a security manager exists. I don't understand what happen if it not exist. In my execution non change nothing, but at the start there's already a default security manager. I wait your answer, bye.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic