java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcessingException 异常解决方案
在SpringMVC中使用Jackson实现json输出时配置如下:
<!-- 输出对象转JSON支持 -->
<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.MappingJacksonHttpMessageConverter"></bean> <bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="stringConverter"/>
<ref bean="jsonConverter" />
</list>
</property>
</bean>
Maven 坐标情况如下:
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-servlet_2.5_spec</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.10.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
<version>2.4.1</version>
</dependency>
出现异常如下:
严重: Servlet /pcrm threw load() exception
java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcessingException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getDeclaredConstructors(Class.java:1901)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:231)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:976)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:633)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:602)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:521)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:462)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1279)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1192)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
一开始以为没有导入Jackson的Jar包,但排查后发现Maven坐标有了,Jar包也导入项目了,但还是一直错。于是我在导入的Jackson包中查找 org.codehaus.jackson.JsonProcessingException类,发现导入的Jackson包中,并不是org.codehaus的Jackson包,而是com.fasterxml的Jackson包。所以确定是Maven坐标导错了。
解决方案:
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
<version>2.4.1</version>
</dependency>
改成
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.4</version>
</dependency>
java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcessingException 异常解决方案的更多相关文章
- 报错:java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException
报错背景: 执行hdfs-mysql的job任务的时候报错. 报错现象: Exception has occurred during processing command Exception: org ...
- java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcess******
http://blog.csdn.net/jrainbow/article/details/38764039
- Hive报错之java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonFactory
一.问题: 在使用Hive0.11进行select查询的时候报: hive,),site from zhifu; Total MapReduce jobs Launching Job out In o ...
- hadoop出现ava.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonMa ...
- maven项目运行tomcat7-maven-plugin:run时出现Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.util.Scanner(xjl456852原创)
使用tomcat7-maven-plugin插件运行web项目时, 出现下面错误: [WARNING] Error injecting: org.sonatype.plexus.build.incre ...
- java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
RabbitMq配置时常见错误 java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper <de ...
- java.lang.ClassNotFoundException: org.I0Itec.zkclient.IZkStateListener异常解决
在启动Dubbo项目时,出现该异常 java.lang.ClassNotFoundException: org.I0Itec.zkclient.IZkStateListener 解决,引入 <d ...
- java.lang.ClassNotFoundException: org.apache.log4j.Logger 异常
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'd ...
- java.lang.ClassNotFoundException: org.hibernate.engine.FilterDefinition的解决方案
今天在GitHub上面看到一个有意思的项目,下载下来,使用tomcat部署失败,出现异常,网上说JDK版本太高,改低,还是失败. 由于本人有个习惯,更喜欢把项目直接放入tomcat webapps 里 ...
随机推荐
- sqlserver2008 R2中查找未使用过的索引
转自:http://blog.csdn.net/yangzhawen/article/details/7247393 sqlserver2008 R2中查找未使用过的索引: o.name AS 表名 ...
- Commons FileUpLoad 两种上传方式解
traditional API (传统方式) //上传路径 File file = new File("C:/upload"); //临时文件路径 File tempFile = ...
- 基于Ant Design UI框架的React项目
概述 这款基于React开发的UI框架,界面非常简洁美观,在这篇文章中我主要为大家介绍一下如何用Ant开始搭建React项目 详细 代码下载:http://www.demodashi.com/demo ...
- 【centos6.5】安装LAMP
转载至:linux公社 https://www.linuxidc.com/Linux/2014-07/104563.htm
- windows系统同时连接多个openvpn账户
windows系统同时连接多个openvpn账户. 前提 客户端系统:Windows7 64位 OpenVPN版本:OpenVPN 2.3.10 Windows 64位 一.安装 1.安装目录 D:\ ...
- 一个月入门Python爬虫,轻松爬取大规模数据
Python爬虫为什么受欢迎 如果你仔细观察,就不难发现,懂爬虫.学习爬虫的人越来越多,一方面,互联网可以获取的数据越来越多,另一方面,像 Python这样的编程语言提供越来越多的优秀工具,让爬虫变得 ...
- mysql max和count、limit优化
1.max 的优化记得要对max里面的字段使用索引,可以大大加快速度 2.count的优化,count(*)和count(id) 的结果可能是不一样的,因为可能存在null的情况 3.distinct ...
- iOS 获取屏幕某个区域的截图-b
-(void)fullScreenshots{ UIWindow *screenWindow = [[UIApplicationsharedApplication] keyWindow]; UIGra ...
- List多个字段标识过滤
class Program { public static void Main(string[] args) { List<T> list = new List<T>(); ...
- python pivot() 函数
以下为python pandas 库的dataframe pivot()函数的官方文档: Reshape data (produce a “pivot” table) based on column ...