title: Domino Agent and GSON - access denied
body: <p>In an Java agent I want to use GSON to parse json. But when I try:</p>
  
  <pre><code>String jsonReceived = "{'product':'IBM Domino','args':{'since':'1970','current':'9.0.2'}}";
  Product product = (Product) gson.fromJson(jsonReceived, Product.class);
  </code></pre>
  
  <p>I get the message:</p>
  
  <p>java.security.AccessControlException: Access denied ("java.lang.reflect.ReflectPermission" "suppressAccessChecks")</p>
  
  <p>I recently changed the java policy to the max:</p>
  
  <pre><code>grant { 
      permission java.security.AllPermission;
  }
  </code></pre>
  
  <p>So what is restricting me?</p>
  
  <p>Here is the complete code:</p>
  
  <pre><code>import lotus.domino.*;
  
  import com.google.gson.Gson;
  import com.google.gson.GsonBuilder;
  import com.google.gson.JsonParseException;
  
  public class JavaAgent extends AgentBase {
  
      public void NotesMain() throws JsonParseException{
  
          String msg = null;
  
          lotus.domino.Session session = getSession();
          OpenLogItem oli = new OpenLogItem(session);
  
          try {
  
              AgentContext agentContext = session.getAgentContext();
  
              msg = "Agent " + agentContext.getCurrentAgent().getName() + " using runtime version:" + System.getProperty("java.runtime.version");
              oli.logEvent(msg, OpenLogItem.SEVERITY_LOW, null);
  
              Gson gson = new GsonBuilder().create();
  
              msg = "after new Gson()";
              oli.logEvent(msg, OpenLogItem.SEVERITY_LOW, null);
  
              String jsonReceived = "{'product':'IBM Domino'}";
              Product product = (Product) gson.fromJson(jsonReceived, Product.class);
  
              msg = "after gson.fromJson";
              oli.logEvent(msg, OpenLogItem.SEVERITY_LOW, null);
  
  
        } catch(Exception e) {
            oli.logError(e);
        }
     }
  
      public class Product{
          String product;
          String msg = null;
  
          lotus.domino.Session session = getSession();
          OpenLogItem oli = new OpenLogItem(session);
  
          public Product(){
              msg = "Product() // constructor";
              oli.logEvent(msg, OpenLogItem.SEVERITY_LOW, null);
          }
  
          public String getProduct() {
              return product;
          }
  
          public void setProduct(String product) {
              this.product = product;
          }
  
          /*@Override
          public String toString() {
              // TODO Auto-generated method stub
              return "product: " + getProduct();
          }*/
  
  
      }
  }
  </code></pre>