Home > Error Writing > Error Writing Request Body To Server Tomcat

Error Writing Request Body To Server Tomcat

Contents

SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setBufferRequestBody(false); // SPR-7909 RestTemplate rest = new RestTemplate(requestFactory); MultiValueMap multipart = new LinkedMultiValueMap(); multipart.add("access_token", token); Resource fileResource = new FileSystemResource(file); multipart.add("file", fileResource); rest.postForLocation(url, multipart); Any kind of help would be appreciated. To be able to post large files, I need to disable the buffering of the request body (to prevent bug SPR-7909 ), but it causes an "Error writing request body to Home Forum Spring Projects Web This forum is now a read-only archive. navigate here

Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, Yes No OK OK Cancel X I have tried with both Spring 3.1 and 3.2. Error writing unbuffered REST request body to server Page Title Module Move Remove Collapse X Conversation Detail Module Collapse Posts Latest Activity Search Forums Page of 1 Filter Time All Time http://stackoverflow.com/questions/31021899/ant-ioexception-error-writing-request-body-to-server-on-deployment-to-tomcat

Error Writing Request Body To Server Java

All Rights Reserved. If I set bufferRequestBody to true, the code works correctly (for small files). How could I solve that?

String token = ... Terms of Use and Privacy Subscribe to our newsletter Working... File file = ... Ant Error Writing Request Body To Server All commenting, posting, registration services have been turned off.

Caused by: java.io.IOException: Error writing request body to server at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:2716) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2699) at org.springframework.http.client.SimpleStreamingClientHttpRequest$NonClosingOutputStream.write(SimpleStreamingClientHttpRequest.java:123) at org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:113) at org.springframework.http.converter.ResourceHttpMessageConverter.writeInternal(ResourceHttpMessageConverter.java:87) at org.springframework.http.converter.ResourceHttpMessageConverter.writeInternal(ResourceHttpMessageConverter.java:44) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:179) at org.springframework.http.converter.FormHttpMessageConverter.writePart(FormHttpMessageConverter.java:306) at org.springframework.http.converter.FormHttpMessageConverter.writeParts(FormHttpMessageConverter.java:270) at org.springframework.http.converter.FormHttpMessageConverter.writeMultipart(FormHttpMessageConverter.java:260) at org.springframework.http.converter.FormHttpMessageConverter.write(FormHttpMessageConverter.java:200) Httpurlconnection Error Writing Request Body To Server Code: String url = ...