jyriand jyriand - 1 year ago 122
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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download