title: Exception: com.fasterxml.jackson.databind.JsonMappingException: N/A
body: <p>I'm getting an exception while trying to send an object from my angular service to the RestController:</p>
  
  <blockquote>
    <p>2017-02-26 12:08:46.612  WARN 2766 --- [nio-8080-exec-6].w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: N/A
        at [Source: java.io.PushbackInputStream@1e2c3f38; line: 1, column: 117] (through reference chain: com.model.Project["status"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: N/A
        at [Source: java.io.PushbackInputStream@1e2c3f38; line: 1, column: 117] (through reference chain: com.model.Project["status"])</p>
  </blockquote>
  
  <p>My service function:</p>
  
  <pre><code>self.saveProjectToDB = function(project) {
      return $http({
          method: 'POST',
          url: '/project/save',
          data: project,
          headers: {
              'Content-Type':'application/json'
          }
      });
  
  };
  </code></pre>
  
  <p>Object being sent:</p>
  
  <pre><code>12:20:17.182 Object { id: "58b2af85db91990ace5b1e20", title: "ffs", deadline: null, owner: null, leader: null, status: null, skills: null, resources: Array[3], $$hashKey: "object:26" } 1 resourceCtrl.js:41:4
  </code></pre>
  
  <p>My RestController function:</p>
  
  <pre><code>    @RequestMapping(value = "save", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
  public ResponseEntity&lt;?&gt; saveProject(@RequestBody Project project) {
      if(project == null) {
          return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Body missing!");
      }
      Project savedProject = projectService.saveProject(project);
      return ResponseEntity.status(HttpStatus.CREATED).body(savedProject);
  }
  </code></pre>
  
  <p>And my model class:</p>
  
  <pre><code>@Document(collection = "project")
  public class Project  {
  
  
  @Id
  private String id;
  private String title;
  private String deadline;
  private String owner;
  private String leader;
  private String status;
  @DBRef
  private List&lt;Skill&gt; skills;
  @DBRef(lazy=true)
  private List&lt;Resource&gt; resources;
  
  /* Constructor and getters/setters */
  </code></pre>
  
  <p>The response status I'm getting is 400 which suggests that the RequestBody project is null.</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>Okay so it only works if status != null, which is strange because all the other variables are allowed to be null.</p>