Closed qimeinajie closed 3 years ago
@qimeinajie What is your target server (Tomcat/Spring MVC/Spring WebFlux etc.)? What the configuration on the target server for the multipart upload? (for example Tomcat has default upper limit) Check this https://youtu.be/LLSln1_JAMY?t=2634
target server Tomcat,springboot version is 2.1.4
So spring.servlet.multipart.max-file-size=10MB
, what's the size of the file that you try to send to Tomcat? Are there any exceptions on Tomcat server?
@violetagg Limit is playing a role, also take the initiative to throw exceptions, the target service is normal, back to 400, the question now is whether springcloud - gateway forwarding the request, but returned to the 500, so the problem is to find you, or I should go to https://github.com/spring-cloud/spring-cloud-gateway/issues to create issue over there
So your question is why SCG does not return 400 back to the client but transforms it to 500, is that correct?
@violetagg Yes
@violetagg Yes
Then we should discuss this with SCG
@violetagg Yes
Then we should discuss this with SCG
I just created an Issue in SCG https://github.com/spring-cloud/spring-cloud-gateway/issues/2125
@qimeinajie I was able to track this from SCG to Tomcat and then to what happens in Reactor Netty. I'm working on a fix for Reactor Netty. Once I'm ready I'll provide a PR.
@qimeinajie I was able to track this from SCG to Tomcat and then to what happens in Reactor Netty. I'm working on a fix for Reactor Netty. Once I'm ready I'll provide a PR.
Thank you very much and good luck,I will wait patiently for your good news
@qimeinajie Will you be able to test the current Reactor Netty 1.0.4-SNAPSHOT. It is available from https://repo.spring.io/snapshot
@qimeinajie Will you be able to test the current Reactor Netty 1.0.4-SNAPSHOT. It is available from https://repo.spring.io/snapshot
Thank you very mush! But I still have some problems: I added some configuration to the pom.xml file
The following error was reported when the container started
java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.gateway.config.GatewayAutoConfiguration$NettyConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:507) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:404) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:389) at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:447) at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:738) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:679) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:647) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1518) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:511) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:481) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:602) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:594) at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1226) at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:865) at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:853) at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:840) at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:791) at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1214) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1203) at org.oschina.apigateway.ApiGatewayApplication.main(ApiGatewayApplication.java:13) Caused by: java.lang.NoClassDefFoundError: reactor/netty/tcp/ProxyProvider$Builder at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.getDeclaredMethods(Class.java:1975) at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489) ... 21 common frames omitted Caused by: java.lang.ClassNotFoundException: reactor.netty.tcp.ProxyProvider$Builder at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 25 common frames omitted
@qimeinajie It seems that you use older Spring Boot with newer Reactor Netty. Reactor Netty 1.0.x is compatible with Spring Boot 2.4.x. Which Spring Boot version do you use?
@qimeinajie Were you able to test the fix?
@@qimeinajie I'm closing this. You can check 1.0.4 release.
@violetagg Hi, is this fixed for Spring boot 2.2.x?
@reysy No only Spring Boot that is supporting Reactor Netty 1.0.x
1062 Like this。
springboot version is 2.1.7.RELEASE spring cloud version is Greenwich.SR3
The problem is that a client request is content-type multipart/form-data and contains files. When forwarded to an upstream service, the server returns a status code of 400, while Springcloud-gateway returns a status code of 500