jclouds IOExpection:将请求正文写入服务器时出错

时间:2015-07-16 12:08:50

标签: java jclouds cloudfiles rackspace-cloudfiles

我们将Get-ChildItem "C:\root" -Recurse | Foreach-Object { If ($_.PSIsContainer) { Get-ChildItem $_.fullname | Foreach-Object { Write-Host $_.fullname } } } jclouds一起使用,并在通过Rackspacecloudfile api

上传大量文件时

当我们在multi threaded行上收到异常时(请参见底部的示例代码)

异常

objectApi.put

16-Jul-2015 11:58:00.811 SEVERE [threadsPool-1] org.jclouds.logging.jdk.JDKLogger.logError error after writing 8192/streaming bytes to https://*****/****.jpg java.io.IOException: Error writing request body to server at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3478) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3461) at com.google.common.io.CountingOutputStream.write(CountingOutputStream.java:53) at com.google.common.io.ByteStreams.copy(ByteStreams.java:74) at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.writePayloadToConnection(JavaUrlHttpCommandExecutorService.java:297) at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:160) at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:64) at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:91) at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:90) at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:73) at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:44) at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117) at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87) at com.sun.proxy.$Proxy176.put(Unknown Source) at

的类似问题

can be found here

示例代码

S3

问题:

任何人都有过这样的行为吗?也许某人有针对这类问题的解决方法?

由于

阿龙

1 个答案:

答案 0 :(得分:1)

网络不可靠,因此在使用云服务时需要一些例外,特别是在处理许多文件时。特别是对于jclouds上传,我们在这里有一些示例代码:

https://github.com/jclouds/jclouds-examples/tree/master/blobstore-uploader

编辑:我还添加了一个JIRA问题,以确保我们在swift中专门针对这种情况添加测试:

https://issues.apache.org/jira/browse/JCLOUDS-965