JSON Mapping in my Spring MVC 3.2 Application Works for Only One of My Methods <p>I am working on a Spring 3.2 MVC application. It's setup fairly typically, but my problem is that I am getting a 406 status error when I attempt to return a JSON object from my controller methods. </p> <p>The frustrating part is that I get that response from the server from all but one of my methods. The code I have included is a modified Spring MVC json example I found on the web. The sample's controller method with the path variable works as expected, but the additional methods that I added to the controller do not.</p> <p>The only other change I made to the sample code occurs in the pom. I upgraded the jackson dependency to the latest version.</p> <p>So what am I missing? I have the jackson mapper jars on my classpath. I'm using the <code>&lt;mvc:annotation-driven /&gt;</code> directive in my servlet and I'm using the <code>@ResponseBody</code> annotation with each of my controller methods.</p> <p>Any help would be greatly appreciated!</p> <p>Dispatcher servlet:</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt; &lt;context:component-scan base-package="uk.co.jeeni" /&gt; &lt;mvc:annotation-driven /&gt; &lt;/beans&gt; </code></pre> <p>pom.xml:</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;uk.co.jeeni&lt;/groupId&gt; &lt;artifactId&gt;spring-json&lt;/artifactId&gt; &lt;version&gt;1.0.0&lt;/version&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;name&gt;Spring 3 MVC JSON Example&lt;/name&gt; &lt;properties&gt; &lt;spring.version&gt;3.2.1.RELEASE&lt;/spring.version&gt; &lt;/properties&gt; &lt;dependencies&gt; &lt;!-- Jackson mapper is used by spring to convert Java POJOs to JSON strings. --&gt; &lt;dependency&gt; &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt; &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt; &lt;version&gt;1.9.12&lt;/version&gt; &lt;/dependency&gt; &lt;!-- START: Spring web --&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-core&lt;/artifactId&gt; &lt;version&gt;${spring.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-web&lt;/artifactId&gt; &lt;version&gt;${spring.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt; &lt;version&gt;${spring.version}&lt;/version&gt; &lt;/dependency&gt; &lt;!-- END: Spring web --&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.2&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.5&lt;/source&gt; &lt;target&gt;1.5&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt; &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt; &lt;version&gt;2.1&lt;/version&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;finalName&gt;spring-mvc-json&lt;/finalName&gt; &lt;/build&gt; </code></pre> <p></p> <p>Controller:</p> <pre><code> package uk.co.jeeni; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller public class JsonService { private static Map&lt;String, Person&gt; data = new HashMap&lt;String, Person&gt;(); static{ data.put("ADAM", new Person("Adam", "Davies", 42)); data.put("JANE", new Person("Jane", "Harrison", 35)); } @RequestMapping(value="{name}", method = RequestMethod.GET) public @ResponseBody Person getPerson(@PathVariable String name){ Person p = new Person(name, name, 105);//data.get(name.toUpperCase()); return p; } @RequestMapping(value="/testJson.html", method=RequestMethod.GET) public @ResponseBody List&lt;Person&gt; testJson() { List&lt;Person&gt; people = new ArrayList&lt;Person&gt;(); for(int i=0;i&lt;10;i++) { Person p = new Person("Firstname", "Lastname", i); people.add(p); } return people; } @ResponseBody @RequestMapping(value="testJsonPojo.html", method=RequestMethod.GET) public Person testJsonPojo() { Person individual = new Person("Firstname", "Lastname", 105); return individual; } } </code></pre> <p>Person.java:</p> <pre><code> package uk.co.jeeni; public class Person { private String firstName; private String lastName; private int age; public Person(String firstName, String lastName, int age) { this.firstName = firstName; this.lastName = lastName; this.age = age; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } </code></pre>