"Error writing request body to server" on upload ~50Mb file
rtrestini Mar 12, 2015 2:37 PMHi guys,
I'm starting to evaluate Modeshape 4.1.0-Final with Wildfly 8.2. My installation is completely default with no modification in any configuration file, except those mentioned in this guide [1]. I'm not an expert neither with Wildfly nor Modeshape, but I couldn't find any reference to this error.
I'm just trying to upload a file with ~50Mb.
Assuming:
- a remote installation in a Centos 7 linux box
- java 1.8.0_20
- using CMIS with AtomPub
- the client code:
public void saveFile(String folderName, String originalName, byte[] fileContent){ Map properties = new HashMap(); properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:unversioned-document"); properties.put(PropertyIds.NAME, originalName); InputStream fileStream = new ByteArrayInputStream(fileContent); String mimetype = // guessMimeType(fileContent); "application/zip"; ContentStream contentStream = new ContentStreamImpl( originalName, BigInteger.valueOf(fileContent.length), mimetype, fileStream); Folder folder = null; if( folderName == null ){ folder = this.client.getSession().getRootFolder(); } else { folder = (Folder) this.client.getSession().getObjectByPath(folderName); } Document newDoc = folder.createDocument( properties, contentStream, VersioningState.NONE); }
The error raised is the following:
org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Cannot access "http://192.168.10.79:8080/modeshape-cmis/atom/artifacts/children?id=ef2822b9-bc1f-42aa-891c-bd753da1c0a8&versioningState=none": Error writing request body to server at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:230) at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invokePOST(DefaultHttpInvoker.java:65) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:646) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:121) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1043) at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:77) at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:451) at modeshapetest.cmis.PutFileFacade.save(PutFileFacade.java:102) at modeshapetest.cmis.PutFileFacade_save_IntegrationTest.putHugeFileOk(PutFileFacade_save_IntegrationTest.java:170) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: com.ctc.wstx.exc.WstxIOException: Error writing request body to server at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:388) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomEntryWriter.writeContent(AtomEntryWriter.java:244) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomEntryWriter.write(AtomEntryWriter.java:181) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl$1.write(ObjectServiceImpl.java:123) at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:196) ... 35 more Caused by: java.io.IOException: Error writing request body to server at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:2840) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2823) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109) at com.ctc.wstx.io.UTF8Writer.write(UTF8Writer.java:143) at com.ctc.wstx.sw.BufferingXmlWriter.writeRaw(BufferingXmlWriter.java:269) at com.ctc.wstx.sw.BufferingXmlWriter.writeCharacters(BufferingXmlWriter.java:568) at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:385) ... 39 more
For obvious reason, I will not attach the file that I'm trying to upload, but I've tried with different sizes and types and, apparently after 10Mb all failed.
Thank you for help.
Rafael
[1] http://www.mastertheboss.com/jboss-frameworks/modeshape/nosql-data-storage-with-modeshape-4