spring-cloud-gateway
spring-cloud-gateway copied to clipboard
embedded tomcat server unable to parse grpc response - ClassCastException
Describe the bug I am trying to enable grpc support for my reactive spring cloud gateway based application. We use tomcat server instead of the default netty server. Currently getting this error while my application parses the grpc response from the server.
java.lang.ClassCastException: class org.apache.catalina.connector.ResponseFacade cannot be cast to class reactor.netty.http.server.HttpServerResponse (org.apache.catalina.connector.ResponseFacade and reactor.netty.http.server.HttpServerResponse are in unnamed module of loader 'app')
at org.springframework.cloud.gateway.filter.headers.GRPCResponseHeadersFilter.filter(GRPCResponseHeadersFilter.java:44)
Environment/versions: Spring boot - 3.0.6, Spring cloud - 2022.0.2, JDK - 17 Issue also reproducible with Spring boot - 2.7.x, Spring cloud - 2021.0.5, JDK - 11
Sample Issue reproduced here
@Albertoimpl FYI, Raised this as an issue. Thanks.
Thanks a lot for the reproducer, I understand what the problem is now. Sadly, @siganapathy Spring Cloud Gateway does not support Tomcat today but the good news is that support for it is in the making: https://github.com/spring-cloud/spring-cloud-gateway/pull/2949
Also, as a note, your gRPC clients and gRPC servers can be running in Tomcat without any problems while Spring Cloud Gateway keeps running using Netty.
This will not be fixed by #2949, but by #145 as I don't know if GRPC support will land in the initial MVC implementation.
Hi @spencergibb Is this issue fixed now? I am using springboot version 3.2.3 and spring cloud 2023.0.0. However i am still facing same error of ClassCastExecption while parsing Grpc response.