s_lavie
asked on
RMI AccessControlException - VM parameter
I'm running an RMI server application with the VM parameter:
-Djava.security.policy=fil e:"C:\RMIT est"\rmi.p olicy
and everything works fine.
When I'm trying to set that parameter using:
System.setProperty("java.s ecurity.po licy", "file:\"C:\\RMITest\"\\rmi .policy"); // the first line in code
I get the following exception:
java.security.AccessContro lException : access denied (java.io.FilePermission server.properties read)
at java.security.AccessContro lContext.c heckPermis sion(Acces sControlCo ntext.java :270)
at java.security.AccessContro ller.check Permission (AccessCon troller.ja va:401)
at java.lang.SecurityManager. checkPermi ssion(Secu rityManage r.java:542 )
at java.lang.SecurityManager. checkRead( SecurityMa nager.java :887)
at java.io.FileInputStream.<i nit>(FileI nputStream .java:100)
at java.io.FileInputStream.<i nit>(FileI nputStream .java:66)
...
Why?
Is there a way to avoid that VM parameter?
-Djava.security.policy=fil
and everything works fine.
When I'm trying to set that parameter using:
System.setProperty("java.s
I get the following exception:
java.security.AccessContro
at java.security.AccessContro
at java.security.AccessContro
at java.lang.SecurityManager.
at java.lang.SecurityManager.
at java.io.FileInputStream.<i
at java.io.FileInputStream.<i
...
Why?
Is there a way to avoid that VM parameter?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.