mercredi 24 juin 2015

Amazon S3 Upload NoHttpResponseException

I have the next code for uploading files to an Amazon S3:

AmazonS3Client client = new AmazonS3Client(credentials, 
            new ClientConfiguration().withMaxConnections(100)
                                  .withConnectionTimeout(120 * 1000)
                                  .withMaxErrorRetry(15));
TransferManager tm = new TransferManager(client);
TransferManagerConfiguration configuration = new TransferManagerConfiguration();
configuration.setMultipartUploadThreshold(MULTIPART_THRESHOLD);
tm.setConfiguration(configuration);

Upload upload = tm.upload(bucket, key, file);

try {
    upload.waitForCompletion();
} catch(InterruptedException ex) {
    logger.error(ex.getMessage());
} finally {
    tm.shutdownNow(false);
}

It works, but some uploads(1GB) produce the next log message:

 INFO AmazonHttpClient:Unable to execute HTTP request: bucket-name.s3.amazonaws.com failed to respond
 org.apache.http.NoHttpResponseException: bucket-name.s3.amazonaws.com failed to respond

I have tried to create TransferManager without AmazonS3Client, but it doesn't help.

Is there any way to fix it?




Aucun commentaire:

Enregistrer un commentaire