相关文章推荐
好帅的抽屉  ·  r - /usr/bin/ld: ...·  11 月前    · 
威武的长颈鹿  ·  Java 输入/输出 I/O流 ...·  1 年前    · 

做录音上传到AmazonS3云服务器上有一段时间了,遇到这个问题归纳起来见过两次。一次是用AmazonS3测试环境下的配置去进行上传,结果失败;这次是把项目部署测试环境上,运行代码时结果失败。两次的原因细节上不同,虽然都归结于权限问题。报错信息大致相同~

下面是报错信息:

com.amazonaws.SdkClientException: Unable to execute HTTP request: life.hcp.group.taikang.com
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1069)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1035)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:742)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:716)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
    at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4169)
    at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4116)
    at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1700)
    at com.taikang.ts.service.OutsourcingBusinessService.sftpUploadToAmazonS3(OutsourcingBusinessService.java:244)
    at com.taikang.ts.service.OutsourcingBusinessService.handelTask(OutsourcingBusinessService.java:105)
    at com.taikang.ts.service.OutsourcingBusinessService$$FastClassBySpringCGLIB$$63fe3d27.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.j

原因分析:
出现这个Unable to execute HTTP request 问题,一般为网路不通导致。
一个是你要上传代码的这台机器的ip没有权限,一个是你的机器域名不能解析正确,导致这个请求失败。
像亚马逊这个云服务本身是要钱的,不是谁都能随随便便连上,往上扔东西。。。,你买了人家的服务,人家才会给你一套配置来连接。一般包括:endpoint , accesskey , secretkey, bucketName这四个。就像你获取数据源一样需要用户名密码啥的一样,有了这,还要一套域名解析,把你加进去,你的Ip才能正确解析,请求才是有效的(个人理解,因为这个公司内部别的部门负责,我接触不到。。。)。所以剩下的就是申请权限吧~

阿里云对象存储上传或复制文件时报 The request signature we calculated does not match the signature you provided. Check your key and signing method. WARN [qtp691614805-21] oss.log Exception (62) |[Server] Unable to execute HTTP request : The request signature we calculated do. com . amazon aws . Sdk Client Exception : Unable to execute HTTP request : Connect to me-file-manager.s3.cn-north-1.jdcloud-oss. com :8 上传文件到OSS报错: [Server] Unable to execute HTTP request : Position is not equal to file length 控制台报类似以下的错: [ErrorCode]: PositionNotEqualToLength [ Request Id]: 603D07EA9ACC07383080C699 [HostId]: naiyi-course.oss-cn-shenzhen.aliyuncs. com [ResponseError]: <?xml v 在使用 amazon S3的时候,当在 amazon ec2 上面运行 S3的时候,把配置的证书 修改为 使用默认的 amazon ec2的证书的时候,出现了一下异常 com . amazon aws . http . Amazon Http Client execute HelperINFO: Unable to execute HTTP request : hostname in certificate didn... 使用“OSS Client ”的上传文件方法“putObject()”遇到报错 报错信息: Unable to execute HTTP request :The request signature we calculated does not match the signature you provided. Check your key and signing method 报错原因: “bucketName”错误 object的key错误,检查key值,路径错误也会报错 我有一个现有的 aws lambda函数,并且尝试使用 AWS Lambda Client (库: aws -java- sdk -lambda)调用它。 如果lambda的运行时少于5分钟,我会得到响应。 但是,如果lambda运行时超过5分钟,我会得到一个例外: com . amazon aws . Sdk Client Exception : Unable to execute HTTP request : The targ... 解决:本地网络问题 2、上传报错 <[Server] Unable to execute HTTP request : You have no right to access this object because of bucket acl. [ErrorCode]: AccessDenied [ Request Id]: 5B2B076B [HostId]: oss-xxx- 项目中多处使用阿里云 OSS 服务,但测试环境最近频频出现异常 [ Client ] Unable to execute HTTP request : Socket Exception 。起初还以为会不会是上传方式有问题,从普通上传改为了分片上传,本想通过官方文档和浏览器检索看看有没有相关问题,但都没有什么结论。 后来在阿里云控制台提交工单,描述了一下异常情况后也没有得到很好的解决,但获得了有用的线索——OSS 日志,紧接着去开通了日志管理服务。 但这个搜索字段也是蛮多,由于异常的原因获取不到 Request ID,只能 报错信息如下: Exception in thread &quot;main&quot; com . amazon aws .services.sns.model. Amazon SNS Exception : The request signature we calculated does not match the signature you provided. Check ... public static void main(String[] args) throws FileNotFound Exception { Client Configuration conf = new Client Configuration(); conf.setConnectionTimeout(5000); conf.setMaxErrorRetry(3); conf.setProxyHost("