title: AngularJS post to Jersey generates com.sun.jersey.server.wadl.generators.WadlGeneratorJAXBGrammarGenerator$8 resolve SEVERE: null
body: <p>I have a jersey server. When I attempt to handle a POST from AngularJS (1.2.16), it is generating an error (below).   When I use a java jersey client to post the message, the jersey server handles it fine.</p>
  
  <p>SEVERE: null
  java.lang.IllegalAccessException: Class com.sun.jersey.server.wadl.generators.WadlGeneratorJAXBGrammarGenerator$8 can not access a member of class javax.ws.rs.core.Response with modifiers "protected"
      at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:101)
      at java.lang.Class.newInstance(Class.java:427)</p>
  
  <p>this is the jersey post server:</p>
  
  <pre><code>@POST
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/post")
  public Response verifyAccount( Owner owner ,
      @Context HttpServletRequest req)
  {
      LOGGER.debug("verify account " +owner.toString() );
      HashMap&lt;String, Object&gt; results = new HashMap&lt;String, Object&gt;();
      boolean verified = AccountManagement.verifyAccount(owner.getEmail(),
          owner.getPwd());
      if (verified) {
          results.put("status", "OK");
      } else {
          results.put("status", "Fail");
      }
      return Response.status(200).entity(results)
          .header("Access-Control-Allow-Origin", "*")
          .header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE")
          .build();
  }
  </code></pre>
  
  <p>This is the jersey java client:</p>
  
  <pre><code>public class JsonClient {
  public static void main(String[] args) {
      try {
          Client client = Client.create();
          WebResource webResource = client
              .resource("http://myserver.com:8080/restws/accountcheck/post");
  
          String input = "{\"email\":\"fubar@gmail.com\",\"pwd\":\"hello\"}";
  
          ClientResponse response = webResource.type("application/json")
              .post(ClientResponse.class, input);
  
          int code = response.getStatus();
          if (code != 200) {
              throw new RuntimeException("Failed : HTTP error code : "
                  + response.getStatus());
          }
  
          System.out.println("Output from Server .... \n");
          String output = response.getEntity(String.class);
          System.out.println(output);
      } catch (Exception e) {
          System.out.println("exception caught.");
          e.printStackTrace();
      }
  }
  }
  </code></pre>
  
  <p>This is the AngularJS code to post:
      $scope.ownerLoginAction = function() {</p>
  
  <pre><code>var dataObject = {
  "email": $scope.myId,
  "pwd": $scope.mypassword
  };
  
  var request = $http({
          method: "post",
          url: hostName+'/restws/accountcheck/post',
          params: {
              action:"verify"
          },
          data: dataObject
      });
  request.then (function(response) {
          console.log(response.data);
     },function(errResponse) {
          console.error('Error');
      } )
  }
  </code></pre>
  
  <p>Anybody know why I cannot seem to post either with JSON from AngularJS?   Is the server not set up right?  Or the angularJS client is not right?</p>
  
  <p>When i put a TCPMON in between, I noticed that the angularJS attempt sent an OPTION.   Is that a clue that I dont understand?</p>