java的amazonaws接口出现无法执行http请求:管道中断

java使用amazonaws的接口上传文件到minio出现以下异常:

com.amazonaws.SdkClientException: Unable to execute HTTP request: Broken pipe (Write failed)

at com.amazonaws.http.AmazonHttpClient R e q u e s t E x e c u t o r . h a n d l e R e t r y a b l e E x c e p t i o n ( A m a z o n H t t p C l i e n t . j a v a : 1175 ) a t c o m . a m a z o n a w s . h t t p . A m a z o n H t t p C l i e n t RequestExecutor.handleRetryableException(AmazonHttpClient.java:1175) at com.amazonaws.http.AmazonHttpClient RequestExecutor.handleRetryableException(AmazonHttpClient.java:1175)atcom.amazonaws.http.AmazonHttpClientRequestExecutor.executeHelper(AmazonHttpClient.java:1121)

at com.amazonaws.http.AmazonHttpClient R e q u e s t E x e c u t o r . d o E x e c u t e ( A m a z o n H t t p C l i e n t . j a v a : 770 ) a t c o m . a m a z o n a w s . h t t p . A m a z o n H t t p C l i e n t RequestExecutor.doExecute(AmazonHttpClient.java:770) at com.amazonaws.http.AmazonHttpClient RequestExecutor.doExecute(AmazonHttpClient.java:770)atcom.amazonaws.http.AmazonHttpClientRequestExecutor.executeWithTimer(AmazonHttpClient.java:744)

at com.amazonaws.http.AmazonHttpClient R e q u e s t E x e c u t o r . e x e c u t e ( A m a z o n H t t p C l i e n t . j a v a : 726 ) a t c o m . a m a z o n a w s . h t t p . A m a z o n H t t p C l i e n t RequestExecutor.execute(AmazonHttpClient.java:726) at com.amazonaws.http.AmazonHttpClient RequestExecutor.execute(AmazonHttpClient.java:726)atcom.amazonaws.http.AmazonHttpClientRequestExecutor.access 500 ( A m a z o n H t t p C l i e n t . j a v a : 686 ) a t c o m . a m a z o n a w s . h t t p . A m a z o n H t t p C l i e n t 500(AmazonHttpClient.java:686) at com.amazonaws.http.AmazonHttpClient 500(AmazonHttpClient.java:686)atcom.amazonaws.http.AmazonHttpClientRequestExecutionBuilderImpl.execute(AmazonHttpClient.java:668)

at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:532)

at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:512)

at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4914)

at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4860)

at com.amazonaws.services.s3.AmazonS3Client.access 300 ( A m a z o n S 3 C l i e n t . j a v a : 389 ) a t c o m . a m a z o n a w s . s e r v i c e s . s 3. A m a z o n S 3 C l i e n t 300(AmazonS3Client.java:389) at com.amazonaws.services.s3.AmazonS3Client 300(AmazonS3Client.java:389)atcom.amazonaws.services.s3.AmazonS3ClientPutObjectStrategy.invokeServiceCall(AmazonS3Client.java:5793)

at com.amazonaws.services.s3.AmazonS3Client.uploadObject(AmazonS3Client.java:1786)

at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1746)

at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1687)

查了半天代码,后来发现是文件路径有问题。

上传文件的接口,第一个参数是桶名称,第二个参数是文件名称,文件名称是可以包含目录的。

在linux下的minio,这个文件路径必须使用"/"分隔,因为我这里的文件是在windows生成的,所以文件路径包含"",在liunx的minio上传就出现这个异常。把目录分隔符修改成"/",然后再上传就成功了。

相关推荐
m0_571957581 小时前
Java | Leetcode Java题解之第543题二叉树的直径
java·leetcode·题解
一点媛艺2 小时前
Kotlin函数由易到难
开发语言·python·kotlin
姑苏风2 小时前
《Kotlin实战》-附录
android·开发语言·kotlin
奋斗的小花生3 小时前
c++ 多态性
开发语言·c++
魔道不误砍柴功3 小时前
Java 中如何巧妙应用 Function 让方法复用性更强
java·开发语言·python
NiNg_1_2343 小时前
SpringBoot整合SpringSecurity实现密码加密解密、登录认证退出功能
java·spring boot·后端
闲晨3 小时前
C++ 继承:代码传承的魔法棒,开启奇幻编程之旅
java·c语言·开发语言·c++·经验分享
老猿讲编程4 小时前
一个例子来说明Ada语言的实时性支持
开发语言·ada
Chrikk5 小时前
Go-性能调优实战案例
开发语言·后端·golang
幼儿园老大*5 小时前
Go的环境搭建以及GoLand安装教程
开发语言·经验分享·后端·golang·go