Could not initialize class com.fasterxml.jackson.databind.SerializationConfig
2017-08-14 18:00
12552 查看
问题
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相关文章推荐
- 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
- Could not load com/fasterxml/jackson/core/JsonGenerator.class
- com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.apache.ibati
- java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
- java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
- java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
- java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
- Could not initialize class com.sun.xml.ws.spi.ProviderImpl 异常处理
- Could not initialize class com.android.xml.AndroidXPathFactory解决办法
- java.lang.ClassNotFoundException: com.fasterxml.jackson.core.util.DefaultIndenter
- (转) java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
- java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
- java.lang.ClassNotFoundException: com.fasterxml.jackson.datatype.joda.JodaModule
- com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class ...
- java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
- jboss java.lang.NoClassDefFoundError: Could not initialize class com.documentum.fc.client.DfClient
- with root cause java.lang.NoClassDefFoundError:Could not initialize class com.AlipaySubmit
- Could not initialize class com.taobao.diamond.client.impl.DiamondEnvRepo