Posts

Showing posts from September, 2015

Spring, Java - @ResponseBody(JSON) request returning Internal Server Error 500

Problem:Requests to return an JSON object returns Internal Server Error 500
Solution:
Controller:
@RequestMapping(method = RequestMethod.GET, value = "/get")
public@ResponseBody Question getQuestionsAjax() {                 (...) return (...); } mvc-dispatcher-servlet.java:<!-- Set the Spring context to allow for dispatching request to Controllers --> <mvc:annotation-driven/> <!--  Allow JSON objects to be returned --> <beanid="jacksonMessageConverter"class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"/> Pom.xml<dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.0</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> <version>1.9.0</version> </dependency> @RequestMapping(method = RequestMethod.GET, value = &…