• 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上传就出现这个异常。把目录分隔符修改成”/",然后再上传就成功了。

  • 相关阅读:
    展厅显示大屏怎么选,展厅使用哪种显示大屏好?
    UNCTF2022 writeup
    uniapp-vue3 项目初始化集成配置【开箱即用】
    ORACLE - 数据查询
    图的存储结构--邻接矩阵
    【SSM框架】Spring笔记 --- 事务详解
    不是吧?30秒 就能学会一个python小技巧?!
    【jmeter】
    php strtr其他语言实现
    【接口测试】工具篇Postman
  • 原文地址:https://blog.csdn.net/my9988/article/details/133744045