Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring web application, try to send response as json throwing error 500 error
    primarykey
    data
    text
    <p>I am developing a web application in Spring framework. When the requests are getting served as ModelAndView respose type. It is working good but when i try to serve response as json it is throwing an error as </p> <p><strong>exception</strong></p> <pre><code>org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.codehaus.jackson.map.SerializationConfig.isEnabled(Lorg/codehaus/jackson/map/SerializationConfig$Feature;)Z org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259) </code></pre> <p><strong>root cause</strong></p> <pre><code>java.lang.NoSuchMethodError: org.codehaus.jackson.map.SerializationConfig.isEnabled(Lorg/codehaus/jackson/map/SerializationConfig$Feature;)Z org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.writeInternal(MappingJacksonHttpMessageConverter.java:193) </code></pre> <p><strong>Method in Controller</strong></p> <pre><code>@RequestMapping(value="/getFBFriendsList",method=RequestMethod.GET)&lt;br/&gt; public @ResponseBody List&lt;String&gt; getStatesList(HttpServletRequest req){&lt;br/&gt; List&lt;String&gt; statesList = null; try{&lt;br/&gt; statesList = new ArrayList&lt;String&gt;();&lt;br/&gt; //..here i am getting states from datebase and adding to list&lt;br/&gt; }&lt;br/&gt; catch(Exception e){}&lt;br/&gt; return statesList; } </code></pre> <p><strong>Configurations in dispatcher Servlet</strong></p> <pre><code>&lt;bean id="jsonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" &gt; &lt;property name="supportedMediaTypes" value="application/json" /&gt; &lt;/bean&gt; &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt; &lt;property name="messageConverters"&gt; &lt;list&gt; &lt;ref bean="jsonHttpMessageConverter" /&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt; &lt;property name="viewClass"&gt; &lt;value&gt; org.springframework.web.servlet.view.tiles2.TilesView &lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p><strong>And i am using jackson jars</strong></p> <ul> <li>jackson-core-asl-1.9.0.jar<br/></li> <li>jackson-mapper-asl-1.9.0.jar<br/></li> <li>json-lib-0.9.jar<br/></li> </ul> <p>and Spring version is 3.2.4</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload