问题

Spring web 与 Spring eureka集成后出现错误:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.databind.SerializationConfig
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:560) ~[jackson-databind-2.8.9.jar:2.8.9]
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:476) ~[jackson-databind-2.8.9.jar:2.8.9]
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:588) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:57) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:61) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.web.filter.HttpPutFormContentFilter.<init>(HttpPutFormContentFilter.java:63) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.boot.web.filter.OrderedHttpPutFormContentFilter.<init>(OrderedHttpPutFormContentFilter.java:29) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration.httpPutFormContentFilter(WebMvcAutoConfiguration.java:149) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$$EnhancerBySpringCGLIB$$362ebeb8.CGLIB$httpPutFormContentFilter$1(<generated>) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$$EnhancerBySpringCGLIB$$362ebeb8$$FastClassBySpringCGLIB$$95d8aacd.invoke(<generated>) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$$EnhancerBySpringCGLIB$$362ebeb8.httpPutFormContentFilter(<generated>) ~[spring-boot-autoconfigure-1.5.6.RELEASE.jar:1.5.6.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
... 27 common frames omitted

pom.xml:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.6-RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
<version>1.2.7-RELEASE</version>
</dependency>

解决方案

pom文件指定

jackson-databind

具体版本:

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.9</version>
</dependency>

参考

Jackson Dependency Issue in Spring Boot with Maven Build

文章同步发布: https://www.geek-share.com/detail/2713704801.html

参考文章:

Class com.fasterxml.jackson.databind.ser.BasicSerializerFactory can not access a member of class com

ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper的解决办法

JACKSON报错:java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.exc.InvalidDefinitionExce

最新文章

  1. python学习笔记-(十四)I/O多路复用 阻塞、非阻塞、同步、异步
  2. 与POS机通信时的3DES(双倍长)加密解密
  3. CoreLocation框架的使用---定位,求两地距离
  4. LUCAS 定理
  5. 深入解析java虚拟机-jvm运行机制
  6. UISegmentControl 、UIStepper
  7. sql获取表字段名、描述和类型
  8. 快速构建Windows 8风格应用15-ShareContract构建
  9. 豹哥嵌入式讲堂:ARM知识概要杂辑(2)- 第一款Cortex-M处理器
  10. 如何用cmd通过sublime打开文件?
  11. 【Python 02】计算机与程序设计
  12. Gitbush笔记
  13. Python3基础 list len 输出元素的个数
  14. linux安装chrome浏览器
  15. spring的bean在什么时候被实例化
  16. 小学四则运算APP 第一个冲刺阶段 第一天
  17. Oracle 修改用户名
  18. SPFA算法 O(kE)
  19. 写一个标准宏MIN,输入两个参数,返回较小的
  20. Mybatis知识(3)

热门文章

  1. C#基础知识总结(一)
  2. (intellij ieda激活码、CLion激活码、php storm激活码、webstorm激活码、jetbrains全家桶激活码)
  3. jenkins自动化部署项目1--下载安装启动(windows)
  4. PyCharm中创建项目时,在所创建的python虚拟环境下的pip失效
  5. java使用POI操作excel文件,实现批量导出,和导入
  6. linux常用开发命令总结
  7. java多线程技术核心
  8. ArcSDE编辑数据ArcMap系统崩溃
  9. 彻底理解CORS跨域原理
  10. mac下idea中安装docker插件