前提:项目框架基于springcloud,我的A服务需要调用B服务的接口,服务正常注册在nacos上,服务也没有做负载,
过程:通过feignclient 调用B服务的接口,控制台报错
nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens; nested exception is com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens;
直接返回了熔断器的内容
排查发现,请求可以顺利调用B服务的接口并在B服务中返回结果。在postman测试该接口确实正常。问题来了:返回到A服务中就直接熔断,开始疯狂百度得到两个方向排查:1-序列化。2-返回的内容解压缩;
后来无意间发现B服务的配置设置开启压缩模式
后来想想为啥postman等工具能调通接口,是因为默认支持解压gzip
所以最终解决方案是:关闭请求压缩功能