jyriand jyriand - 8 months ago 57
JSON Question

Spring MVC and JSON, Jackson class not found exception

I cant get Spring's JSON support working. In my spring-servlet.xml file i have included following lines:

<context:component-scan base-package="my.packagename.here" />
<context:annotation-config />

<bean id="viewResolver"
p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />

<bean id="jacksonMessageConverter"

I have also downloaded jackson libraries and added them to my eclipse project and also to WEB-INF/lib folder. When sending request to controller with jQuery getJSON method i get following errors:

javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw exception
java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonProcessingException
java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcessingException

What do you think is the problem. I'm guessing it has something to do with my
file. I can paste entire error log, if you need.


JsonProcessingException is part of the jackson-core-asl-x.x.x.jar. Make sure that it's part of your classpath.