问题描述

在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. PHP生成随机或者唯一字符串
  2. bootstrap4 调整元素之间距离
  3. WinCE下串口虚拟软件
  4. activeMQ 安装于使用
  5. dubbo web工程示例_带有Dubbo的Spring Cloud Alibaba
  6. linux 内核 性能,Linux内核十个版本性能对比
  7. CXF(2.7.10) - A simple JAX-WS service
  8. Linux下让Eclipse支持Python
  9. React中受控组件和非受控组件
  10. Ubuntu搭建Android NDK开发环境并编译Demo
  11. 第3章 Kafka API
  12. Tungsten Fabric知识库丨更多组件内部探秘
  13. Random Walk 随机游走算法
  14. java+vue实现onlyoffice协同办公
  15. 揭秘!苏宁“信息基础设施”型零售实践大解析
  16. 最新YGBOOK小说站源码/全自动采集+已修BUG
  17. 如何对某一个文件夹下的所有文件快速重命名
  18. 单机网站服务器,端游【天之炼狱241】单机版一键端网单+GM工具
  19. 点击图片放大,实现移动端双指缩放,单指拖拽功能
  20. 单元测试覆盖分析指标-翻译中

热门文章

  1. F1V3.0-图形-前端绘图库简介
  2. webpack打包构建列表隔行变色案例
  3. Map集合中的两种取出方式keySet和entrySet
  4. python实现单位换算计算
  5. UML2面向对象分析与设计(第2版) 谭火彬 杂记
  6. idea 调试class文件
  7. 我的童年—爷爷、弟弟和我
  8. 编译原理——正规式、NFA转换构造DFA、DFA的化简
  9. weblogic学习教程(一)
  10. 【备忘】32期JavaEE系列视频教程就业班