转发: Feign报错feign.RetryableException: too many bytes written executing
Feign报错feign.RetryableException: too many bytes written executing
- SpringCloud Feign调用报错feign.RetryableException: too many bytes written executing
SpringCloud Feign调用报错feign.RetryableException: too many bytes written executing
SpringCloud : Greenwich.SR5
SpringBoot : 2.1.9.RELEASE
SpringCloudAlibaba : 2.1.0.RELEASE
看到这个错误第一时间我也是打开百度/Goole 但是搜出来的,无一例外 基本都是添加feign增强包 feign-httpclient 或者feign-okhttp 包;
无奈之下只好一步步debug 发现是把request.body 写入到流时发生的错误.java.io.IOException: insufficient data written
后面搜到body是跟Content-Length
有关系的… 附上博主链接 https://my.oschina.net/u/4410077/blog/3323588 看了之后 原来发生这个问题的原因跟我一样,因为服务之间调用需要携带一些用户信息之类的 所以实现了Feign的RequestInterceptor
拦截器复制请求头,复制的时候是所有头都复制的,可能导致Content-length长度跟body不一致. 所以只需要判断如果是Content-length就跳过
原配置 :
/*** @author Joe* createTime 2020/06/10 18:13*/
@Log4j2
@Configuration
public class FeignConfiguration implements RequestInterceptor {@Overridepublic void apply(RequestTemplate template) {ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();HttpServletRequest request = attributes.getRequest();Enumeration<String> headerNames = request.getHeaderNames();if (headerNames != null) {while (headerNames.hasMoreElements()) {String name = headerNames.nextElement();String values = request.getHeader(name);template.header(name, values);}} else {log.info("feign interceptor error header:{}", template);}}
}
修改之后:
/*** @author Joe* createTime 2020/06/10 18:13*/
@Log4j2
@Configuration
public class FeignConfiguration implements RequestInterceptor {@Overridepublic void apply(RequestTemplate template) {ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();HttpServletRequest request = attributes.getRequest();Enumeration<String> headerNames = request.getHeaderNames();if (headerNames != null) {while (headerNames.hasMoreElements()) {String name = headerNames.nextElement();String values = request.getHeader(name);// 跳过 content-lengthif (name.equals("content-length")){continue;}template.header(name, values);}} else {log.info("feign interceptor error header:{}", template);}}
}
问题解决!!!!
content-length详解参考文章 :https://juejin.im/post/5d772cb4e51d453b5f1a0502
转发: Feign报错feign.RetryableException: too many bytes written executing相关推荐
- Feign报错feign.RetryableException: too many bytes written executing
Feign报错feign.RetryableException: too many bytes written executing SpringCloud Feign调用报错feign.Retryab ...
- feign.RetryableException: too many bytes written executing POST
在使用feign的时候 出现这个错误 记录一下 原代码如下 import feign.RequestInterceptor; import feign.RequestTemplate; import ...
- feign.RetryableException: too many bytes written executing
fegin 远程调用报错 feign.RetryableException: too many bytes written executing POST - 解决办法 pom中添加依赖 <dep ...
- SpringCloud Feign调用报错feign.RetryableException: too many bytes written executing
因为服务之间调用需要携带一些用户信息之类的 所以实现了Feign的RequestInterceptor拦截器复制请求头,复制的时候是所有头都复制的,可能导致Content-length长度跟body不 ...
- Request processin g failed; nested exception is feign.RetryableException: too many bytes written
错误信息: 2020-09-08 14:07:14.718 ERROR 16146 --- [io-12000-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet ...
- nacos的feign报错Error creating bean with name ‘configurationPropertiesBeans‘ defined in class path reso
nacos的feign报错Error creating bean with name 'configurationPropertiesBeans' defined in class path reso ...
- gateway 转发weboskct 报错 ClassCastException
使用环境: springcloud gateway 转发 websocket 报错 报错内容: 15:30:38.092 [http-nio-9999-exec-1] ERROR c.m.g.e.Gl ...
- springboot feign too many bytes written executing
报错 springboot feign too many bytes written executing 解決办法 <dependency><groupId>io.github ...
- python3报错 TypeError: can’t concat bytes to str 原因与解决方法
在做项目的时候,Python3会报错如下错误: TypeError: can't concat bytes to str 意思是: 类型错误:无法将字节连接到字符串 类似的错误有: TypeError ...
最新文章
- 前端工程师的mysql笔记
- (转)利用Ant与Proguard混淆引用的子工程项目jar包及打war包
- python 奇偶链表
- python sns绘制回归线_SVM--支持向量机amp;Python代码
- boost::next_permutation相关的测试程序
- C++11- const, const expression和constexpr
- java用while循环语句输出1-100内的奇数和
- java程序能转变为javafx_躁!DJ 风格 Java 桌面音乐播放器
- html5 斗鱼 苹果,斗鱼ios端手游直播方法
- lcx端口转发linux_LCX端口转发及NC反弹
- 苹果手机访问html文件夹,iPhone如何访问Windows的共享文件夹
- 有没有无痛无害的人体成像方法?OCT(光学相干断层扫描)了解一下
- flappy bird游戏
- https:/问题解析remote: Total 10021 (delta 0), reused 0 (delta 0), pack-reused 10021 Receiving objects: 1
- 深度丨银行零售客群策略与标签体系搭建指南
- 2021-10-20 推荐一个在线视频格式转换的好网站https://www.zamzar.com/,我测试过mp4转到gif
- Android 的动作、广播、类别等标识大全
- 01|读研这三年,你亏么?(研一篇)
- 吃透考研数学教材,这6点必须注意!
- pyinstaller打包torch运行后报错
热门文章
- Neat Download Manager(ndm下载器)
- 微服务架构中职能团队的划分
- Android 一直出现waiting for debugger解决
- python的xlrd读取Excel数据失败: raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+‘; not supported‘) ...
- Safari 与 Edge:哪种浏览器更适合 Mac
- python 小说词频统计_Python中文分词及词频统计
- 虚拟私有云(Virtual Private Cloud,VPC)
- 小米redmibook14系统重装、c盘分区以及rdo远程方法
- scrapy自定义扩展(extensions)实现实时监控scrapy爬虫的运行状态
- linux中scsi驱动程序,不用软驱 在Linux上也能安装RAID驱动程序