title: How to define a java security policy file in WAS?
body: <p>I am developing an enterprise application using RMI, and I get an error while trying to (re)bind the object : </p>
  
  <pre><code>Naming.rebind(url, this);
  </code></pre>
  
  <p>// The object "this" is a subclass of UnicastRemoteObject
  Before this instruction I create a new RMISecurityManager with : </p>
  
  <pre><code>if (System.getSecurityManager() == null) {
      System.setSecurityManager(new RMISecurityManager());
  }
  </code></pre>
  
  <p>The exact error is :</p>
  
  <pre><code>[err] java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.reflect")
  </code></pre>
  
  <p>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.</p>
  
  <p>I tried to set the file with the instruction :
  <code>System.setProperty("java.security.policy", ".../security/java.policy");</code>
  And with that, it worked !</p>
  
  <p>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.</p>