问题描述

在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相关推荐

  1. feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverter found

    出错的代码: UserBaseDto lmsInfo = userBaseClient.getUserById(pointMqVo.getUserId(), pointMqVo.getPlatform ...

  2. error info: feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverte

    使用feign框架的@FeignClient调用GET请求,并接受json返回值的时候,会报Could not extract response: no suitable HttpMessageCon ...

  3. feign.codec.DecodeException: Error while extracting response for type

    报错信息 feign.codec.DecodeException: Error while extracting response for type [java.util.List<cn.xxx ...

  4. openfeign远程调用接口报错:feign.codec.DecodeException: Error while extracting response for type

    错误信息: feign.codec.DecodeException: Error while extracting response for type [java.util.List<xxxx. ...

  5. 【springCloud】feign.RetryableException: Read timed out executing GET.。的有效解决办法

    1.错误如下图 2.解决办法 错误提示是请求超时,那我们就把请求的时间改大不久行了,这也是网上的大多数朋友给的解决方案,在网关配置ribbon: ribbon:ConnectTimeout: 6000 ...

  6. 【异常】 ‘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 ...

  7. 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 ...

  8. Spring Cloud Open Feign系列【11】Feign 编码解码器Encoder和Decoder源码分析

    文章目录 概述 接口及相关实现类 Encoder 接口 Decoder接口 执行流程源码分析 1. 项目结构改造 2. 编码器流程 3. 解码器流程 4. 异常解码处理流程 5. 404异常特殊处理 ...

  9. 【Spring】Feign客户端发送HTTPS请求绕过认证

    1.概述 转载:https://www.jianshu.com/p/ea627708ab52 一个Spring Boot项目,为了使用Harbor仓库,起初通过Spring RestTemplate完 ...

最新文章

  1. System.Timers.Timer的Enable、Start、Stop记录
  2. Citrix VDI实战攻略之八:测试验收
  3. 如何配置三层交换机创建VLAN 3
  4. pythonweb面试常见问题_python和web框架面试题目整理(3)
  5. python抖音github_使用 Python 下载抖音无水印视频
  6. 挖洞经验:通过Vimeo的文件上传功能发现其SSRF漏洞
  7. Bone collector//动态规划
  8. 21岁还可以学php开发吗,PHP已经21岁了!
  9. 二等水准数据平差_二等水准复测平差成果表
  10. 江苏约谈滴滴、T3出行等6家企业 因疫情防控落实不到位
  11. Pausing and Resuming an Activity
  12. [LeetCode][easy]Create Target Array
  13. 基于onvif协议的嵌入式设备(摄像头)开发(客户端)
  14. 计算机换位加密,基于位平面变换的数字图像加密算法
  15. 如何将影像地图转换为国家2000坐标系
  16. 及时复盘的好处_及时复盘,促进成长
  17. oracle 18c 新特性,Oracle 18c新特性测试
  18. 来信, 创业 和 移动互联网
  19. 使用unbound在RHEL7上搭建DNS服务
  20. vue实现密码显示隐藏、很简单易懂

热门文章

  1. ECharts-地图
  2. PIL安装失败解决方法
  3. Python Tornado框架
  4. c语言日历软件下载显示农历的,系统时间显示农历(KClock)
  5. 推荐系统——(一)经典论文文献及业界应用
  6. ElasticSearch搜索引擎✧完结
  7. MySQL时间类分区写SQL的一些注意事项
  8. LeetCode198. House Robber
  9. 利用Textbolb对EXCEL文本里的英文评论进行情感分析
  10. 处理SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“.报错