Table of Contents
HTTP Status 406 –
type Status report
message
description The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request “accept” headers.
Apache Tomcat/7.0.59
While using @ResponseBody annotation above error is communally generate:
Solution:
1.Add following configuration in spring-servlet.xml file:
<mvc:annotation-driven/> <!-- Must require to enable @ResponseBody annotation -->
2. Add following configuration in pom.xml file
<properties> <maven-compiler-plugin-version>2.3.2</maven-compiler-plugin-version> </properties> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>${jaction.xml.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jaction.xml.version}</version> </dependency>
Complete working example as under : /spring4-mvc-json-example/
Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.