Exception when getting a list of buckets on s3 using Jets3t

Using the S3 service i am trying to retrieve the list off all the buckets.While i am doing this i am getting an exception.

I am getting a S3 service exception: java.lang.Long cannot be cast to java.lang.Integer.

Here is the code:

    String awsKey = "awskey";
    String awsSecret = "secret";
    AWSCredentials aws = new AWSCredentials(awsKey,awsSecret);

    //communicate with s3
    try{
    S3Service service = new RestS3Service(aws);

    //get buckets
    S3Bucket[] buckets = service.listAllBuckets();

Here is the stack trace:

<code>    org.jets3t.service.S3ServiceException: Request Error:             java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at org.jets3t.service.S3Service.listAllBuckets(S3Service.java:1370)
at UploadToS3.main(UploadToS3.java:20) Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at org.apache.http.params.AbstractHttpParams.getIntParameter(AbstractHttpParams.java:70)
at org.apache.http.client.params.HttpClientParamConfig.getRequestConfig(HttpClientParamConfig.java:54)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:806)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.performRequest(RestStorageService.java:334)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.performRequest(RestStorageService.java:281)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.performRestGet(RestStorageService.java:981)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.listAllBucketsImpl(RestStorageService.java:1373)
at org.jets3t.service.StorageService.listAllBucketsImpl(StorageService.java:1379)
at org.jets3t.service.StorageService.listAllBuckets(StorageService.java:563)
at org.jets3t.service.S3Service.listAllBuckets(S3Service.java:1367)

Any help would be appreciated. Thanks.

2 answers

  • answered 2013-12-16 15:04 Nischal Hp

    It was an issue with http client , had to use an older version.

    Was using 4.3.1 , had to use 4.2.

  • answered 2014-01-15 00:53 Tony Ghita

    The issue has been fixed, but not released (HTTPCLIENT-1418). Look for the fix in version 4.3.2 of Apache HttpComponents HttpClient.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum