spring cloud 报NoClassDefFoundError: Could not initialize class xx.xx.SerializationConfig

启动以后,后台报错:

java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.databind.SerializationConfig
	at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:558) ~[jackson-databind-2.8.8.jar:2.8.8]
	at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:474) ~[jackson-databind-2.8.8.jar:2.8.8]
	at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:588) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE]
	at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:57) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE]
	at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:61) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE]
	at org.springframework.web.client.RestTemplate.<init>(RestTemplate.java:159) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE]
	at org.springframework.web.client.RestTemplate.<init>(RestTemplate.java:188) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE]
	at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getSecureRestTemplate(ConfigServicePropertySourceLocator.java:195) ~[spring-cloud-config-client-1.3.2.RELEASE.jar:1.3.2.RELEASE]
	at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:78) ~[spring-cloud-config-client-1.3.2.RELEASE.jar:1.3.2.RELEASE]
	at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:93) ~[spring-cloud-context-1.2.3.RELEASE.jar:1.2.3.RELEASE]

我以为是没有引入包,但是,引入了又报 spring core的包找不到……

最后发现,是maven的配置文件 spring-cloud-starter-eureka 和 spring-cloud-starter-config写反了

	<dependencies>
	
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-eureka</artifactId>
		</dependency>
				<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-config</artifactId>
		</dependency>
</dependencies>
这个文件是要报错的。   config应该写前面eureka 应该写后面。 写好顺序就解决了。不然要报莫名其妙的找不到类的错误。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值