title: Client Policy : access denied : java.net.SocketPermission 127.0.0.1:1099
body: <p>I have a strange error : </p>
  
  <p>my Code : </p>
  
  <pre><code>System.setProperty("java.security.policy", "client.policy");
  System.setProperty("java.rmi.server.codebase", Servicecodebase);
  System.setSecurityManager(new RMISecurityManager()); 
  
      Class&lt;?&gt; InterfaceMath =  RMIClassLoader.loadClass("http://127.0.0.1/dis/service.jar", "Service.InterfaceMath");
  
  
  
      Remote service = null;                  
       service  = Naming.lookup("rmi://127.0.0.1:1099/ok"); //  Error Message here
      Method getInformation = service.getClass().getDeclaredMethod("test", String.class);
      String res = (String) getInformation.invoke(service);
       System.out.println(" res : "+res);
  </code></pre>
  
  <p>My file client.policy :</p>
  
  <pre><code>grant {
      permission java.security.AllPermission;
      permission java.net.SocketPermission "localhost:1099", "connect, resolve";
      permission java.net.SocketPermission "127.0.0.1:1099", "connect, resolve";
      permission java.net.SocketPermission "localhost:80", "connect, resolve";
  };
  </code></pre>
  
  <p>my error :</p>
  
  <pre><code>java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve")
  </code></pre>
  
  <p>I take on Eclipse in Run Configuration - VM Arguments -Djava.security.policy==client.policy
  And I lanch ---  Start rmiregistry on the console.</p>
  
  <p>It's strange because I have configure my File, I load my Interface but i can't communicate with my RMI. Server  I don't know why I have this problem.</p>
  
  <p>update : 
  my project ClientRMI :</p>
  
  <ol>
  <li>src </li>
  <li>(Default package)</li>
  <li>consumerTest.java</li>
  <li>client.policy</li>
  </ol>