JsonProcessingException thrown when trying writeValueAsString
<p>I am new to Jackson. I am trying to just serialize a POJO (plain old java object) to JSON, and I keep getting a JsonProcessingException. I really do not understand why. Am I missing something?</p>

<pre><code>public class Car {
    private String make;
    private String model;

    public String getMake() {
        return make;
    }

    public void setMake(String make) {
        this.make = make;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public Car (String make, String model) {
        this.make = make;
        this.model = model;
    }
}
</code></pre>

<p>and then elsewhere I have....</p>

<pre><code>try {
    Car car = new Car("honda", "accord");        

    String serialized;

    // enable pretty formatting
    ObjectMapper mapper = new ObjectMapper();
    mapper.enable(SerializationFeature.INDENT_OUTPUT);

    serialized = mapper.writeValueAsString(car);

    System.out.println(serialized);
} catch (JsonProcessingException e) {
    System.out.println("Failed to serialize the object to JSON");
}
</code></pre>

<p>And my output is simply</p>

<pre><code>Failed to serialize the object to JSON
</code></pre>

<p>What could possibly be going wrong here? I do not understand how this exception could be getting thrown.</p>