Spring3升级到Spring4时, 运行时出现找不到MappingJacksonHttpMessageConverter的情况
[org.springframework.web.context.ContextLoader]Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0'
... ...
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter] for bean with name 'org.springframework.http.converter.json.MappingJacksonHttpMessageConverter#2aa148c0'
... ...
Caused by: java.lang.ClassNotFoundException: org.springframework.http.converter.json.MappingJacksonHttpMessageConverter
... ...
原因是Spring 3.x 和4.X处理JSON的一个类不一样,而这个东西又配置在xml文件中,所以编译时又无法发现
spring3.x是org.springframework.http.converter.json.MappingJacksonHttpMessageConverter
spring4.x是org.springframework.http.converter.json.MappingJacksonHttpMessageConverter
1. 查找替换所有XML中名字
2. 同时加入最新的FastJackson依赖
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.5</version>
</dependency>
3. 问题解决
不能提前在编译时发现此类错误,而且出错时还很难查找, 这是我不喜欢XML配置的一个原因。
Spring3升级到Spring4时, 运行时出现找不到MappingJacksonHttpMessageConverter的情况的更多相关文章
- 使用Spring4时, 运行时出现找不到MappingJacksonHttpMessageConverter的情况
启动项目报错: [org.springframework.web.context.ContextLoader]Context initialization failed org.springframe ...
- 解决spring3升级到spring4后jackjson报错
1.这里说的是基于spring+springmvc+hibernate框架(其实跟持久层框架也没关系) 2.首先是springmvc的配置,处理json数据都会用到的.第5行是spring-4.x的写 ...
- spring3升级到spring4通用异常处理返回jsonp多了/**/的解决办法
问题描述 在spring3中定义了通用的异常处理,具体代码如下: public class CommonExceptionHandler implements HandlerExceptionReso ...
- spring3升级到spring4
升级又失败了,dao层太多要改了,记录一下修改的内容,也是没白费我一下午时间 1. org.springframework.orm.hibernate3.annotation.AnnotationSe ...
- ASP.NET 5运行时升级到Beta5
在Visual Studio 2015 RTM和Windows 10正式发布之前,微软把开源.NET升级到了beta5,带来了一些增强和改变.和Visual Studio 2015 RC一起安装的AS ...
- 将asp.net webapi的运行时版本由4.0升级到4.5.1时遇到的问题及解决
更新package 更改.net运行时的版本之后,出现了错误提示,说需要改新以下组件: EntityFramework, EntityFramework.zh-Hans, Microsoft.AspN ...
- Android M Permission 运行时权限 学习笔记
Android M Permission 运行时权限 学习笔记 从Android 6.0开始, 用户需要在运行时请求权限, 本文对运行时权限的申请和处理进行介绍, 并讨论了使用运行时权限时新老版本的一 ...
- 【转】Sqlite 混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该...
开发环境: vs2010+.net framework 4.0+ System.Data.SQLite.DLL (2.0)今天在做Sqlite数据库测试,一运行程序在一处方法调用时报出了一个异常 混合 ...
- Android M以上运行时权限(Google官方出品)
转载请注明出处:http://www.cnblogs.com/cnwutianhao/p/6690152.html 网上运行时权限的例子.Demo无计其数,但是和Google官方出品的比起来,都显得很 ...
随机推荐
- MySQL: sql_safe_updates
在my.cnf中设置sql_safe_updates=1 启动mysqld失败. error log报错: 2018-11-20T14:28:14.567022+08:00 0 [ERROR] unk ...
- [C++] 用Xcode来写C++程序[1] 新建C++项目工程
用Xcode来写C++程序[1] 新建C++项目工程 第一节从新建工程并编译C++源码开始 新建工程 源码: // // main.cpp // YeHelloWorld // // Created ...
- Linode VPS主机套餐方案降低处理方法且不影响数据
使用Linode VPS主机产品经历过512MB内存升级至1GB内存,再升级至2GB内存,以及目前推出1GB内存方案月付10美元.比如我们在使用Linode 2GB内存方案的时候占用资源不是太多,其实 ...
- c# 利用AForge和百度AI开发实时人脸识别
baiduAIFaceIdentify项目是C#语言,集成百度AI的SDK利用AForge开发的实时人脸识别的小demo,里边包含了人脸检测识别,人脸注册,人脸登录等功能 人脸实时检测识别功能 思路是 ...
- TreeSet集合的add()方法源码解析(01.Integer自然排序)
>TreeSet集合使用实例 >TreeSet集合的红黑树 存储与取出(图) >TreeSet的add()方法源码 TreeSet集合使用实例 package cn.itca ...
- September 17th 2017 Week 38th Sunday
Distance could make you forget about them, but the memories would always be there. 距离会让你遗忘,但是回忆却始终在那 ...
- November 16th 2016 Week 47th Wednesday
Success is falling nine times and getting up ten. 成功就是哪怕跌倒九次,也要在第十次爬起来. For most of us, we may choos ...
- [转]Hadoop 读写数据流
Hadoop文件读取 1)客户端通过调用FileSystem对象中的open()函数来读取它做需要的数据.FileSystem是HDFS中DistributedFileSystem的一个实例. 2)D ...
- python第十四课--排序及自定义函数之自定义函数(案例二)
案例二: python中定义有/无返回值的函数,演示python没有函数重载这一说 需求:自定义函数:计算两个整数的和值两个原则:1).有没形参有,两个 2).有没返回值可有可无 def my_sum ...
- 64. [Mcoi2018]终末之诗(上)
Description 求出\(k^{k^{k^{k^{...}}}} \pmod p\) 的结果 扩展欧拉定理:\[a^x=a^{min(x,x\%\varphi(p)+\varphi(p))}(m ...