I am developing an enterprise application using RMI, and I get an error while trying to (re)bind the object :
Naming.rebind(url, this);
// The object "this" is a subclass of UnicastRemoteObject Before this instruction I create a new RMISecurityManager with :
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
The exact error is :
[err] java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.reflect")
I am developing on WAS Liberty Profile 8.5.5. I tried to create java.policy, app.policy, was.policy, server.policy in the META-INF folder of the EAR project, without any success.
I tried to set the file with the instruction :
System.setProperty("java.security.policy", ".../security/java.policy");
And with that, it worked !
What am I missing ? (as this last solution worked, I assume that the java.policy file is well formed and efficient, so it's just about the way to include this file into my ear file and to be taken in configuration into WAS...) Thank you.