2015-02-24 46 views
1

我不知道從何時開始,但我的機器上我得到使用AWS SDK與Java以下錯誤:亞馬遜S3 AWS開始給錯誤代碼400由於未知原因,

2015-02-24 18:57:05,834 DEBUG ~ Receiving response: HTTP/1.1 400 Bad Request 
2015-02-24 18:57:05,834 DEBUG ~ << HTTP/1.1 400 Bad Request 
2015-02-24 18:57:05,834 DEBUG ~ << Server: nginx 
2015-02-24 18:57:05,834 DEBUG ~ << Date: Tue, 24 Feb 2015 18:57:05 GMT 
2015-02-24 18:57:05,834 DEBUG ~ << Content-Type: application/xml 
2015-02-24 18:57:05,834 DEBUG ~ << Transfer-Encoding: chunked 
2015-02-24 18:57:05,834 DEBUG ~ << Connection: keep-alive 
2015-02-24 18:57:05,834 DEBUG ~ << Bucket: "testmedia" 
2015-02-24 18:57:05,834 DEBUG ~ << Accept-Ranges: bytes 
2015-02-24 18:57:05,834 DEBUG ~ << Age: 0 
2015-02-24 18:57:05,834 DEBUG ~ << X-Cache-Hit: No 
2015-02-24 18:57:05,835 DEBUG ~ Connection can be kept alive indefinitely 
2015-02-24 18:57:05,835 DEBUG ~ << "51[\r][\n]" 
2015-02-24 18:57:05,835 DEBUG ~ << "<?xml version="1.0" encoding="UTF-8"?><Error><Code>InvalidArgument</Code></Error>" 
2015-02-24 18:57:05,835 DEBUG ~ << "[\r][\n]" 
2015-02-24 18:57:05,835 DEBUG ~ << "0[\r][\n]" 
2015-02-24 18:57:05,835 DEBUG ~ << "[\r][\n]" 
2015-02-24 18:57:05,835 DEBUG ~ Connection [id: 8][route: {s}->https://testmedia.xxx] can be kept alive indefinitely 
2015-02-24 18:57:05,835 DEBUG ~ Connection released: [id: 8][route: {s}->https://testmedia.xxx][total kept alive: 1; route allocated: 1 of 50; total allocated: 1 of 50] 
2015-02-24 18:57:05,836 DEBUG ~ Received error response: com.amazonaws.services.s3.model.AmazonS3Exception: null (Service: null; Status Code: 400; Error Code: InvalidArgument; Request ID: null), S3 Extended Request ID: null 

我可以上傳文件,所以證書看起來沒問題,但我似乎沒有下載它。我正在使用Play! Framework(1.2.7)運行JDK 1.7和AWS SDK 1.9.22。

這可能是什麼原因造成的?

由於AWS上的1.​​6簽名問題,最近我確實從JDK 1.6切換到了1.7。我還沒有在我的生產服務器上使用它,所以它可能與OS X相關,但不敢將代碼部署到生產環境中,直到我確信它不會中斷。

(AWS-SDK-的java/22年9月1日Mac_OS_X/10.10.3 Java_HotSpot(TM)_64-Bit_Server_VM/24.71-B01/1.7.0_71)

[編輯:] 我的Java代碼:

AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); 
ClientConfiguration clientConfig = new ClientConfiguration(); 
clientConfig.setConnectionTimeout(2500); 

AmazonS3 conn = new AmazonS3Client(credentials, clientConfig); 
conn.setEndpoint(hostUrl);  
S3Object object = conn.getObject(new GetObjectRequest(bucket, fileKey)); 
+0

我認爲它與我的S3服務似乎運行和的CloudStack最新的事實做SDK不起作用。隨着1.8.11的一切再次正常工作! – 2015-02-25 11:49:44

回答

1

它必須與CloudStack和SDK版本。我降級到1.8.11,一切正常!

+0

有趣。降級到1.8.11也解決了我同樣的問題。雖然我沒有使用CloudStack。 – Tiina 2016-02-03 06:19:08