Meaningless Drivel is fun!*
The moose likes Distributed Java and the fly likes Error RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Error RMI" Watch "Error RMI" New topic
Author

Error RMI

Paolo Scire' Scappuzzo
Greenhorn

Joined: Jan 29, 2012
Posts: 4
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

Joined: Jan 29, 2012
Posts: 4
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.


 
Consider Paul's rocket mass heater.
 
subject: Error RMI