Spring Cloud Gateway 中GET请求能正常访问,POST请求出现Unable to handle DataBuffer

报错信息如下:

bash 复制代码
java.lang.IllegalArgumentException: Unable to handle DataBuffer of type class org.springframework.http.server.reactive.UndertowServerHttpRequest$UndertowDataBuffer
        at org.springframework.cloud.gateway.filter.NettyRoutingFilter.getByteBuf(NettyRoutingFilter.java:219)
        Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
        |_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
        |_ checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
        |_ checkpoint ⇢ HTTP POST "/XX/XXX" [ExceptionHandlingWebHandler]
Stack trace:
                at org.springframework.cloud.gateway.filter.NettyRoutingFilter.getByteBuf(NettyRoutingFilter.java:219)
                at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:100)

因为是部署在测试环境不是本地调试的,本地调试是正常的,所以具体的没断点进去看。

然后GET请求是能正常请求到的,而POST请求就全部都不行。

网上查找到的资料也是挺零散的,可能比较少人遇到吧。

按照大佬的解决方法,也依旧解决不了:(这个可以尝试一下)https://blog.csdn.net/qq_38225558/article/details/113045145

后面无意中看见了另外一个大佬的解决思路,解决了。感谢。
https://juejin.cn/post/6979510711781163016

将Undertow容器修改为Tomcat容器

xml 复制代码
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>

gateway的版本:2.2.5.RELEASE

项目里没有看见有引入Undertow的依赖,我直接加上tomcat的依赖,然后就正常了。

相关推荐
折哥的程序人生 · 物流技术专研35 分钟前
第8篇:六大设计原则在工厂模式中的体现
java·设计模式·设计原则·工厂模式·编程进阶·扩充系列
小明bishe181 小时前
计算机毕业设计之基于JAVA的植物科普网站
java·spring boot·spring·架构·课程设计
r_oo_ki_e_1 小时前
Java Map 集合学习笔记
java·笔记·学习
SL-staff2 小时前
智慧园区2000+设备统一管理:JVS-IoT如何降低运维成本40%
java·开发语言·物联网·智慧园区·设备管理·运维优化·jvs-iot
咖啡八杯2 小时前
GoF设计模式——模板方法模式
java·后端·spring·设计模式
爱笑的源码基地3 小时前
一款全开源的信创云PACS影像云平台解决方案,支持多模态医学影像处理(CT/MR/DR/超声/病理等)
java·源码·国产化·pacs·云影像·区域pacs
我命由我123453 小时前
Android 开发问题:ClickableSpan 的点击事件没有生效
java·java-ee·android studio·android jetpack·android-studio·android runtime
万亿少女的梦1683 小时前
基于Python的高考志愿填报辅助系统设计与实现
java·spring boot·python·mysql·vue
微信开发api-视频号协议4 小时前
企业微信外部群开发自动化实践过程
java·前端·微信·自动化·企业微信·ipad
犀利豆4 小时前
#AI in Harness(一)
java·ai编程