spring MVC4以上,使用的json包有变更。
使用之前的json包出包Java .lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException错误。
新用到包为jackson-annotations-2.5.0.jar, jackson-core-2.5.0.jar, jackson-databind-2.5.0.jar
spring-servlet.xml里面也有变动
< bean id = "stringConverter" class = "org.springframework.http.converter.StringHttpMessageConverter" > < property name = "supportedMediaTypes" > < list > < value > text/plain; charset = UTF -8 </ value > </ list > </ property > </ bean > < bean id = "jsonConverter" class = "org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" > </ bean > < bean class = "org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" > < property name = "messageConverters" > < list > < ref bean = "stringConverter" /> < ref bean = "jsonConverter" /> </ list > </ property > </ bean >
以上参考
谭卓博客
»
Springmvc4 com/fasterxml/jackson/core/JsonProcessingException