【feign】feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverter
问题描述
在springboot 2的版本中通过feign进行调用,在引入私服jar包并进行调用时,报错:
feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverter found for response type [xxx.Response<com.xxx.XxxResponseDto>] and content type [application/octet-stream;charset=utf-8]
其中,Response是返回报文实体类,XxxResponseDto是返回报文中的响应体(body部分),返回报文分为head和body两部分,如下
{"head": {"retFlag": "00000","retMsg": "成功"},"body": {"data": {// 报文数据}}
}
分析原因
暂无
解决方法
首先,调用时在请求头header中添加Content-Type = application/json,不行!
其次,像下边的代码一样添加consumes和produces属性
@FeignClient(name = "服务实例名")
public interface XxxClient {@PostMapping(value = "/x/x/x/x", consumes = "application/json;charset=utf-8", produces = "application/json;charset=utf-8")Response<XxxResponseDto> getXXX(@Valid @RequestBody XxxRequestDto requestDto);
}
在加上之后还是不行!
后来,直接用postman调用url为“/x/x/x/x”的接口,发现调不通了,在解决单独调接口调不通这个问题后,再次通过之前的方式调用,可以调通了。
参考文章
【feign】feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverter相关推荐
- feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverter found
出错的代码: UserBaseDto lmsInfo = userBaseClient.getUserById(pointMqVo.getUserId(), pointMqVo.getPlatform ...
- error info: feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverte
使用feign框架的@FeignClient调用GET请求,并接受json返回值的时候,会报Could not extract response: no suitable HttpMessageCon ...
- feign.codec.DecodeException: Error while extracting response for type
报错信息 feign.codec.DecodeException: Error while extracting response for type [java.util.List<cn.xxx ...
- openfeign远程调用接口报错:feign.codec.DecodeException: Error while extracting response for type
错误信息: feign.codec.DecodeException: Error while extracting response for type [java.util.List<xxxx. ...
- 【springCloud】feign.RetryableException: Read timed out executing GET.。的有效解决办法
1.错误如下图 2.解决办法 错误提示是请求超时,那我们就把请求的时间改大不久行了,这也是网上的大多数朋友给的解决方案,在网关配置ribbon: ribbon:ConnectTimeout: 6000 ...
- 【异常】 ‘ascii‘ codec can‘t decode byte 0xe8 in position 2: ordinal not in range(128)
[异常] 'ascii' codec can't decode byte 0xe8 in position 2: ordinal not in range(128) 参考文章: (1)[异常] 'as ...
- feign.codec.EncodeException: Could not write request: no suitable HttpMessageConverter found f
feign.codec.EncodeException: Could not write request: no suitable HttpMessageConverter found for req ...
- Spring Cloud Open Feign系列【11】Feign 编码解码器Encoder和Decoder源码分析
文章目录 概述 接口及相关实现类 Encoder 接口 Decoder接口 执行流程源码分析 1. 项目结构改造 2. 编码器流程 3. 解码器流程 4. 异常解码处理流程 5. 404异常特殊处理 ...
- 【Spring】Feign客户端发送HTTPS请求绕过认证
1.概述 转载:https://www.jianshu.com/p/ea627708ab52 一个Spring Boot项目,为了使用Harbor仓库,起初通过Spring RestTemplate完 ...
最新文章
- PHP生成随机或者唯一字符串
- bootstrap4 调整元素之间距离
- WinCE下串口虚拟软件
- activeMQ 安装于使用
- dubbo web工程示例_带有Dubbo的Spring Cloud Alibaba
- linux 内核 性能,Linux内核十个版本性能对比
- CXF(2.7.10) - A simple JAX-WS service
- Linux下让Eclipse支持Python
- React中受控组件和非受控组件
- Ubuntu搭建Android NDK开发环境并编译Demo
- 第3章 Kafka API
- Tungsten Fabric知识库丨更多组件内部探秘
- Random Walk 随机游走算法
- java+vue实现onlyoffice协同办公
- 揭秘!苏宁“信息基础设施”型零售实践大解析
- 最新YGBOOK小说站源码/全自动采集+已修BUG
- 如何对某一个文件夹下的所有文件快速重命名
- 单机网站服务器,端游【天之炼狱241】单机版一键端网单+GM工具
- 点击图片放大,实现移动端双指缩放,单指拖拽功能
- 单元测试覆盖分析指标-翻译中