尝试连接并清空Amazon s3存储桶时出现“连接被拒绝”错误

时间:2016-04-22 15:47:54

标签: java amazon-web-services amazon-s3

我已经通过api创建了一个Amazon s3存储桶,我可以成功上传文件。但是当我尝试用相同的凭据清空存储桶时,我得到例外“ com.amazonaws.http.AmazonHttpClient:无法执行HTTP请求:连接被拒绝”。

我的代码段如下所示..

AWSCredentials awsCredentials =
            new BasicAWSCredentials(accessKey,secretKey);
    AmazonS3 s3client = new AmazonS3Client(awsCredentials);
    s3client.setEndpoint(endpoint);

堆栈跟踪

INFO  [2016-04-22 14:50:52,885] com.amazonaws.http.AmazonHttpClient: Unable   to execute HTTP request: Connection refused
! java.net.ConnectException: Connection refused
! at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.7.0_79]
! atjava.net.AbstractPlainSocketImpl.doConnectna:1.7.0_79]   
! at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 
! at java.net.Socket.connect(Socket.java:579) ~[na:1.7.0_79]
! at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:625)    org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:409)com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.connectSocket(SdkTLSSocketFactory.java:134)

不确定我是做正确的事还是有代理问题。

0 个答案:

没有答案