报错信息如下:
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的依赖,然后就正常了。