简体   繁体   中英

Error thrown when call post rest api with big data size

I have a problem. When I call a post rest api with big data (about 35 megabyte in body) this exception is thrown:

org.springframework.web.client.ResourceAccessException: 
     I/O error on POST request for "x": Software caused connection abort: recv failed; 
     nested exception is java.net.SocketException: 
     Software caused connection abort: recv failed

I am using wildfly web server and set maxPostSize=250961630, but it is not working.

Can someone help me, please?

The problem solved. In Spring boot,you must define multipartConfigElement bean and set value on setMaxFileSize and setMaxRequestSize properties.The code is:

@Bean
public MultipartConfigElement multipartConfigElement()
{
    MultipartConfigFactory factory = new MultipartConfigFactory();
    factory.setMaxFileSize("1000MB");
    factory.setMaxRequestSize("1000MB");
    return factory.createMultipartConfig();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM