阿里云服务器免费领卷啦。

捡代码论坛-最全的游戏源码下载技术网站!

 找回密码
 立 即 注 册

QQ登录

只需一步,快速开始

搜索
关于源码区的附件失效或欺骗帖, 处理办法
查看: 3273|回复: 0

[开发技术] Spring3升级到Spring4时, 运行时出现找不到MappingJacksonHttpMessageConverter的情况

[复制链接]

4208

主题

210

回帖

12万

积分

管理员

管理员

Rank: 9Rank: 9Rank: 9

积分
126180
QQ
发表于 2017-12-21 10:17:17 | 显示全部楼层 |阅读模式

Spring3升级到Spring4时, 运行时出现找不到MappingJacksonHttpMessageConverter的情况
出错信息:
  1. [org.springframework.web.context.ContextLoader]Context initialization failed
  2. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0'
  3. ... ...
  4. 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'
  5. ... ...
  6. Caused by: java.lang.ClassNotFoundException: org.springframework.http.converter.json.MappingJacksonHttpMessageConverter
  7.     ... ...
复制代码
原因是Spring 3.x 和4.X处理JSON的一个类不一样,而这个东西又配置在xml文件中,所以编译时又无法发现

spring3.x是org.springframework.http.converter.json.MappingJacksonHttpMessageConverter

spring4.x是org.springframework.http.converter.json.MappingJackson2HttpMessageConverter

1. 查找替换所有XML中名字

2. 同时加入最新的FastJackson依赖


  1. <dependency>
  2.                 <groupId>com.fasterxml.jackson.core</groupId>
  3.                 <artifactId>jackson-core</artifactId>
  4.                 <version>2.8.5</version>
  5.             </dependency>
  6.             <dependency>
  7.                 <groupId>com.fasterxml.jackson.core</groupId>
  8.                 <artifactId>jackson-databind</artifactId>
  9.                 <version>2.8.5</version>
  10.             </dependency>
  11.             <dependency>
  12.                 <groupId>com.fasterxml.jackson.core</groupId>
  13.                 <artifactId>jackson-annotations</artifactId>
  14.                 <version>2.8.5</version>
  15.             </dependency>
复制代码
原文:
  1. https://www.cnblogs.com/shihaiming/p/6702572.html
复制代码



捡代码论坛-最全的游戏源码下载技术网站! - 论坛版权郑重声明:
1、本主题所有言论和图片纯属会员个人意见,与本论坛立场无关
2、本站所有主题由该帖子作者发表,该帖子作者与捡代码论坛-最全的游戏源码下载技术网站!享有帖子相关版权
3、捡代码论坛版权,详细了解请点击。
4、本站所有内容均由互联网收集整理、网友上传,并且以计算机技术研究交流为目的,仅供大家参考、学习,不存在任何商业目的与商业用途。
5、若您需要商业运营或用于其他商业活动,请您购买正版授权并合法使用。 我们不承担任何技术及版权问题,且不对任何资源负法律责任。
6、如无法链接失效或侵犯版权,请给我们来信:jiandaima@foxmail.com

回复

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | 立 即 注 册

本版积分规则

技术支持
在线咨询
QQ咨询
3351529868

QQ|手机版|小黑屋|捡代码论坛-专业源码分享下载 ( 陕ICP备15015195号-1|网站地图

GMT+8, 2024-4-26 15:38

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表