Skip to content

Unable to execute HTTP request: Host name 's3.amazonaws.com' does not match the certificate subject provided by the peer #1223

Closed
@ghost

Description

I am using
compile group: 'software.amazon.awssdk', name: 'aws-sdk-java', version:'2.5.29'
and when I am trying to listbuckets I am getting

software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: Host name 's3.amazonaws.com' does not match the certificate subject provided by the peer (CN=s3.amazonaws.com, O=Amazon.com Inc., L=Seattle, ST=Washington, C=US)
	at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:97) ~[sdk-core-2.5.29.jar:na]
	at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.handleThrownException(RetryableStage.java:136) ~[sdk-core-2.5.29.jar:na]
	at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.execute(RetryableStage.java:94) ~[sdk-core-2.5.29.jar:na]
	at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:62) ~[sdk-core-2.5.29.jar:na]
	at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:42) ~[sdk-core-2.5.29.jar:na]

What got changed in the new version ? Following is my code

try {
            s3 = S3Client.builder()
                    .region(Region.of(region))
                    .credentialsProvider(SystemPropertyCredentialsProvider.create())
                    .build();
        } catch (Exception e) {
            e.printStackTrace();
        }
ListBucketsRequest listBucketsRequest = ListBucketsRequest.builder().build();
ListBucketsResponse listBucketsResponse = s3.listBuckets(listBucketsRequest);
 return listBucketsResponse.buckets();

When I try to set the http client to UrlConnectionHttpClient, the class is not found.. Is something missing in the version ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions