Link to home
Start Free TrialLog in
Avatar of s_lavie
s_lavie

asked on

RMI AccessControlException - VM parameter

I'm running an RMI server application with the VM parameter:
-Djava.security.policy=file:"C:\RMITest"\rmi.policy
and everything works fine.
When I'm trying to set that parameter using:
System.setProperty("java.security.policy", "file:\"C:\\RMITest\"\\rmi.policy"); // the first line in code
I get the following exception:
java.security.AccessControlException: access denied (java.io.FilePermission server.properties read)
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
      at java.security.AccessController.checkPermission(AccessController.java:401)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
      at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
      at java.io.FileInputStream.<init>(FileInputStream.java:100)
      at java.io.FileInputStream.<init>(FileInputStream.java:66)
      ...
Why?
Is there a way to avoid that VM parameter?
ASKER CERTIFIED SOLUTION
Avatar of amswain
amswain

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial