Im trying to get json response from my Spring Controller. Im getting below exception
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
I have jackson related jars in pom.xml as below
<properties>
<spring.version>4.2.5.RELEASE</spring.version>
<jstl.version>1.2</jstl.version>
<servletapi.version>2.5</servletapi.version>
<jackson.version>2.6.3</jackson.version>
</properties>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
Below is my controller
@ResponseBody
@RequestMapping(value = "/getNodes.htm",produces="application/json")
public List<NodeDTO> getNodes() {
...
return nodes;
}
Im getting 406 error in the browser and above exception in server log. My browser is properly sending Accept header has application/json. But still Im facing this issue. I have gone through many forums none of them resolving my issue. Please help me to resolve it