aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.16k stars 836 forks source link

LambdaConversionException: Invalid receiver type interface org.apache.http.Header; not a subtype of implementation type interface org.apache.http.NameValuePair #652

Closed alxgrk closed 4 years ago

alxgrk commented 6 years ago

Hi there,

I'm trying to use the cloudsearchdomain service, especially the SwitchToPostInterceptor.

Expected Behavior

Using the CloudSearchDomainClient, I'm trying to upload documents to an existing instance. I expect an HTTP-Response with status code 200, which should be mapped to the Java type SearchResponse.

Current Behavior

Unfortunately, the mapping of the response to the Java type does not seem to work. The method call ends with the exception listed below:

Stacktrace:

java.lang.BootstrapMethodError: call site initialization exception
    at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
    at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
    at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
    at software.amazon.awssdk.http.apache.ApacheHttpClient.transformHeaders(ApacheHttpClient.java:234)
    at software.amazon.awssdk.http.apache.ApacheHttpClient.createResponse(ApacheHttpClient.java:223)
    at software.amazon.awssdk.http.apache.ApacheHttpClient.execute(ApacheHttpClient.java:201)
    at software.amazon.awssdk.http.apache.ApacheHttpClient.access$400(ApacheHttpClient.java:92)
    at software.amazon.awssdk.http.apache.ApacheHttpClient$1.call(ApacheHttpClient.java:178)
    at software.amazon.awssdk.http.apache.ApacheHttpClient$1.call(ApacheHttpClient.java:175)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.MakeHttpRequestStage.executeHttpRequest(MakeHttpRequestStage.java:58)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.MakeHttpRequestStage.execute(MakeHttpRequestStage.java:50)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.MakeHttpRequestStage.execute(MakeHttpRequestStage.java:34)
    at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205)
    at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205)
    at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205)
    at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205)
    at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.doExecute(RetryableStage.java:145)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.execute(RetryableStage.java:111)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:69)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:49)
    at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205)
    at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:57)
    at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:42)
    at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205)
    at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:37)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:25)
    at software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient$RequestExecutionBuilderImpl.execute(AmazonSyncHttpClient.java:283)
    at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.invoke(BaseSyncClientHandler.java:91)
    at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:103)
    at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:68)
    at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:44)
    at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:53)
    at software.amazon.awssdk.services.cloudsearchdomain.DefaultCloudSearchDomainClient.search(DefaultCloudSearchDomainClient.java:124)
        ...
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type interface org.apache.http.Header; not a subtype of implementation type interface org.apache.http.NameValuePair
    at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:233)
    at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
    at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
    ... 67 more

Debug Log:

16:17:55 DEBUG software.amazon.awssdk.core.internal.interceptor.ExecutionInterceptorChain - Creating an interceptor chain that will apply interceptors in the following order: [software.amazon.awssdk.services.cloudsearchdomain.SwitchToPostInterceptor@476febb4]
16:17:55 DEBUG software.amazon.awssdk.request - Sending Request: software.amazon.awssdk.http.DefaultSdkHttpFullRequest@6f088727
16:17:55 DEBUG software.amazon.awssdk.auth.signer.Aws4Signer - AWS4 Canonical Request: '"POST
/2013-01-01/documents/batch
format=sdk
amz-sdk-invocation-id:0700c94d-c5c9-e686-ad10-d76b8ffa0054
amz-sdk-retry:0/0/500
content-length:8020
content-type:application/json
host:xxx.eu-central-1.cloudsearch.amazonaws.com
user-agent:aws-sdk-java/2.0.0-preview-11 Linux/4.13.0-46-generic Java_HotSpot_TM__64-Bit_Server_VM/25.131-b11 Java/1.8.0_131
x-amz-date:20180808T141755Z
x-amz-security-token:***

amz-sdk-invocation-id;amz-sdk-retry;content-length;content-type;host;user-agent;x-amz-date;x-amz-security-token
fba44c92bd49b8d9ce31e0945a925335340dbe2b08cb4da1ea5ace03660afd98"
16:17:55 DEBUG software.amazon.awssdk.auth.signer.Aws4Signer - AWS4 String to Sign: '"AWS4-HMAC-SHA256
20180808T141755Z
20180808/eu-central-1/cloudsearch/aws4_request
8c31ba19f25a532bb190f6f6aa6ecbf7a523308f87b048e366d0b3f296503215"
16:17:55 DEBUG software.amazon.awssdk.auth.signer.Aws4Signer - Generating a new signing key as the signing key not available in the cache for the date 1533686400000
16:17:55 DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
16:17:55 DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
16:17:55 DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://xxx.eu-central-1.cloudsearch.amazonaws.com:443][total kept alive: 0; route allocated: 0 of 50; total allocated: 0 of 50]
16:17:55 DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->https://xxx.eu-central-1.cloudsearch.amazonaws.com:443][total kept alive: 0; route allocated: 1 of 50; total allocated: 1 of 50]
16:17:55 DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://xxx.eu-central-1.cloudsearch.amazonaws.com:443
16:17:55 DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to xxx.eu-central-1.cloudsearch.amazonaws.com/18.194.72.147:443
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory - Connecting to xxx.eu-central-1.cloudsearch.amazonaws.com/18.194.72.147:443
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory - Connecting socket to xxx.eu-central-1.cloudsearch.amazonaws.com/18.194.72.147:443 with timeout 2000
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory - socket.getSupportedProtocols(): [SSLv2Hello, SSLv3, TLSv1, TLSv1.1, TLSv1.2], socket.getEnabledProtocols(): [TLSv1, TLSv1.1, TLSv1.2]
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory - TLS protocol enabled for SSL handshake: [TLSv1.2, TLSv1.1, TLSv1]
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory - Starting handshake
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory - Secure session established
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory -  negotiated protocol: TLSv1.2
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory -  negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory -  peer principal: CN=*.eu-central-1.cloudsearch.amazonaws.com
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory -  peer alternative names: [*.eu-central-1.cloudsearch.amazonaws.com]
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.conn.SdkTlsSocketFactory -  issuer principal: CN=Amazon, OU=Server CA 1B, O=Amazon, C=US
16:17:55 DEBUG software.amazon.awssdk.http.apache.internal.net.SdkSslSocket - created: xxx.eu-central-1.cloudsearch.amazonaws.com/18.194.72.147:443
16:17:55 DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established 172.19.40.86:37986<->18.194.72.147:443
16:17:55 DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: set socket timeout to 30000
16:17:55 DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /2013-01-01/documents/batch?format=sdk HTTP/1.1
16:17:55 DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> POST /2013-01-01/documents/batch?format=sdk HTTP/1.1
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> Host: xxx.eu-central-1.cloudsearch.amazonaws.com
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> amz-sdk-invocation-id: 0700c94d-c5c9-e686-ad10-d76b8ffa0054
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> amz-sdk-retry: 0/0/500
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> Authorization: AWS4-HMAC-SHA256 Credential=ASIA2OY2NTFI6VYH6DWD/20180808/eu-central-1/cloudsearch/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-retry;content-length;content-type;host;user-agent;x-amz-date;x-amz-security-token, Signature=5a24a10fd044d3856fe6c215bb4b1803e9c47d14d082f8137d5c1e330524e5c0
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Type: application/json
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: aws-sdk-java/2.0.0-preview-11 Linux/4.13.0-46-generic Java_HotSpot_TM__64-Bit_Server_VM/25.131-b11 Java/1.8.0_131
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> X-Amz-Date: 20180808T141755Z
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> X-Amz-Security-Token: ***
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 8020
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "POST /2013-01-01/documents/batch?format=sdk HTTP/1.1[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: xxx.eu-central-1.cloudsearch.amazonaws.com[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "amz-sdk-invocation-id: 0700c94d-c5c9-e686-ad10-d76b8ffa0054[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "amz-sdk-retry: 0/0/500[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "Authorization: AWS4-HMAC-SHA256 Credential=ASIA2OY2NTFI6VYH6DWD/20180808/eu-central-1/cloudsearch/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-retry;content-length;content-type;host;user-agent;x-amz-date;x-amz-security-token, Signature=5a24a10fd044d3856fe6c215bb4b1803e9c47d14d082f8137d5c1e330524e5c0[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Type: application/json[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: aws-sdk-java/2.0.0-preview-11 Linux/4.13.0-46-generic Java_HotSpot_TM__64-Bit_Server_VM/25.131-b11 Java/1.8.0_131[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "X-Amz-Date: 20180808T141755Z[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "X-Amz-Security-Token:***[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Length: 8020[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 >> "*** SOME JSON BODY ***"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Type: application/json; charset=utf-8[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Wed, 08 Aug 2018 14:17:55 GMT[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 << "x-amzn-RequestId: d8033f0d-9b15-11e8-aaee-5b329507b6e9[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Length: 46[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 << "Connection: keep-alive[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
16:17:55 DEBUG org.apache.http.wire - http-outgoing-0 << "{"status": "success", "adds": 1, "deletes": 0}"
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 200 OK
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 << Content-Type: application/json; charset=utf-8
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 << Date: Wed, 08 Aug 2018 14:17:55 GMT
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 << x-amzn-RequestId: d8033f0d-9b15-11e8-aaee-5b329507b6e9
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 << Content-Length: 46
16:17:55 DEBUG org.apache.http.headers - http-outgoing-0 << Connection: keep-alive
16:17:55 DEBUG org.apache.http.impl.execchain.MainClientExec - Connection can be kept alive for 60000 MILLISECONDS

Steps to Reproduce (for bugs)

In Maven POM (among other dependencies of [aws-sdk-java|https://github.com/aws/aws-sdk-java]):

        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>cloudsearchdomain</artifactId>
            <version>2.0.0-preview-11</version>
        </dependency>

DomainClient configuration:

CloudSearchDomainClient.builder()
                .endpointOverride(URI.create(cs_document_endpoint))
                .credentialsProvider(cp)
                .build();

UploadDocument operation:

         JSONArray batch = ...;
         byte[] batchAsBytes = batch.toString().getBytes();
        RequestBody requestBody = RequestBody.fromBytes(batchAsBytes);

        UploadDocumentsRequest uploadDocumentsRequest = UploadDocumentsRequest.builder()
                .contentLength(Long.valueOf(batchAsBytes.length))
                .contentType(ContentType.APPLICATION_JSON)
                .build();

        UploadDocumentsResponse result = domain.uploadDocuments(uploadDocumentsRequest,
                requestBody);

Context

As mentioned above, I'm already using the aws-sdk-java CloudSearch client. However, I want to take advantage of the usage of POST as HTTP-Method for every request.

Your Environment

Looking forward to an answer and thanks in advance, Alex

ArturSkowronski commented 6 years ago

I have the same problem with S3Client.getObject @alxgrk

Initial-B commented 6 years ago

I was having this issue with S3Client.putObject, version 2.0.0-preview-12. I also had org.apache.httpcomponents:httpclient:4.5.3 on my classpath from another dependency. After updating httpclient to 4.5.5, the error is no longer occurring.

vbudilov commented 5 years ago

I upgrade to v '2.0.2' and the error is gone.

alxgrk commented 5 years ago

@Initial-B - updating org.apache.httpcomponents:httpclient to 4.5.5 unfortunately didn't solve the problem for me.

@vbudilov - the 'fixed' versions 2.0.* are only released for kinesis, cloudwatch and dynamodb, not cloudsearch.

So these solutions might work for some other AWS services, but not for my original issue.

dagnir commented 5 years ago

@alxgrk Sorry to see you're still experiencing this issue. As @Initial-B pointed out, this is probably a dependency mismatch issue.

Could you show the output of mvn dependency:tree? This will show if the httpclient dependency is the correct version.

alxgrk commented 5 years ago

Hey @dagnir, thanks for your response.

Here's the output of mvn dependency:tree:

[INFO] +- org.springframework:spring-messaging:jar:4.3.18.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.3.7.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-expression:jar:4.3.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-core:jar:4.3.7.RELEASE:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] |  \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- org.jolokia:jolokia-core:jar:1.3.5:compile
[INFO] |  \- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.4.5.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.4.5.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.4.5.RELEASE:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-starter-logging:jar:1.4.5.RELEASE:compile
[INFO] |  |     +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] |  |     |  \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] |  |     +- org.slf4j:jul-to-slf4j:jar:1.7.24:compile
[INFO] |  |     \- org.slf4j:log4j-over-slf4j:jar:1.7.24:compile
[INFO] |  \- org.springframework.boot:spring-boot-actuator:jar:1.4.5.RELEASE:compile
[INFO] +- com.mercateo.boot:metrics-spring-boot-starter:jar:0.1.1:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.5.RELEASE:compile
[INFO] |  +- io.dropwizard.metrics:metrics-core:jar:3.1.3:compile
[INFO] |  +- io.dropwizard.metrics:metrics-jvm:jar:3.1.3:compile
[INFO] |  \- io.github.mweirauch:metrics-jvm-extras:jar:0.1.3:compile
[INFO] +- org.hamcrest:hamcrest-junit:jar:2.0.0.0:test
[INFO] |  +- junit:junit:jar:4.12:compile
[INFO] |  \- org.hamcrest:java-hamcrest:jar:2.0.0.0:test
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.4.5.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.4.5.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.5.RELEASE:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.2.1:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.1:test
[INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.3.0:test
[INFO] |  \- org.springframework:spring-test:jar:4.3.7.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.5.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.4.5.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.5.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat:tomcat-jdbc:jar:8.5.11:compile
[INFO] |  |  |  \- org.apache.tomcat:tomcat-juli:jar:8.5.11:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.0.12.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] |  +- org.hibernate:hibernate-entitymanager:jar:5.0.12.Final:compile
[INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  \- org.springframework.data:spring-data-jpa:jar:1.10.8.RELEASE:compile
[INFO] |     +- org.springframework.data:spring-data-commons:jar:1.12.8.RELEASE:compile
[INFO] |     +- org.springframework:spring-orm:jar:4.3.7.RELEASE:compile
[INFO] |     \- org.springframework:spring-tx:jar:4.3.7.RELEASE:compile
[INFO] +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] |  +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] +- org.zalando:faux-pas:jar:0.2.0:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.1:compile
[INFO] |  +- com.google.gag:gag:jar:1.0.1:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.24:compile
[INFO] +- com.ryantenney.metrics:metrics-spring:jar:3.1.3:compile
[INFO] |  +- io.dropwizard.metrics:metrics-healthchecks:jar:3.1.2:compile
[INFO] |  +- io.dropwizard.metrics:metrics-annotation:jar:3.1.2:compile
[INFO] |  +- org.springframework:spring-context-support:jar:4.3.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-aop:jar:4.3.7.RELEASE:compile
[INFO] +- org.modelmapper:modelmapper:jar:1.1.0:compile
[INFO] +- com.h2database:h2:jar:1.4.193:test
[INFO] +- org.postgresql:postgresql:jar:9.4.1212.jre7:compile
[INFO] +- org.liquibase:liquibase-core:jar:3.5.3:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.17:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.4.5.RELEASE:compile
[INFO] |  +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] |  |  \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.7:compile
[INFO] |  +- org.springframework:spring-web:jar:4.3.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:4.3.7.RELEASE:compile
[INFO] +- com.google.guava:guava:jar:21.0:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- com.google.guava:guava-testlib:jar:18.0:test
[INFO] |  \- com.google.truth:truth:jar:0.23:test
[INFO] +- org.springframework:spring-aspects:jar:4.3.7.RELEASE:compile
[INFO] |  \- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] +- org.projectlombok:lombok:jar:1.16.14:provided
[INFO] +- org.mapstruct:mapstruct-jdk8:jar:1.2.0.Final:compile
[INFO] +- org.mapstruct:mapstruct-processor:jar:1.2.0.Final:provided
[INFO] +- org.springframework.cloud:spring-cloud-starter-aws:jar:1.1.3.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-aws-context:jar:1.1.3.RELEASE:compile
[INFO] |  |  \- org.springframework.cloud:spring-cloud-aws-core:jar:1.1.3.RELEASE:compile
[INFO] |  |     +- com.amazonaws:aws-java-sdk-s3:jar:1.11.18:compile
[INFO] |  |     |  \- com.amazonaws:aws-java-sdk-kms:jar:1.11.18:compile
[INFO] |  |     +- com.amazonaws:aws-java-sdk-ec2:jar:1.11.18:compile
[INFO] |  |     \- com.amazonaws:aws-java-sdk-cloudformation:jar:1.11.18:compile
[INFO] |  \- org.springframework.cloud:spring-cloud-aws-autoconfigure:jar:1.1.3.RELEASE:compile
[INFO] |     +- org.springframework.cloud:spring-cloud-aws-actuator:jar:1.1.3.RELEASE:compile
[INFO] |     +- com.amazonaws:aws-java-sdk-ses:jar:1.11.18:compile
[INFO] |     +- com.amazonaws:aws-java-sdk-cloudwatch:jar:1.11.18:compile
[INFO] |     +- javax.mail:javax.mail-api:jar:1.5.6:compile
[INFO] |     +- com.amazonaws:elasticache-java-cluster-client:jar:1.1.0:compile
[INFO] |     \- com.amazonaws:aws-java-sdk-elasticache:jar:1.11.18:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-aws-jdbc:jar:1.1.3.RELEASE:compile
[INFO] |  \- org.springframework.cloud:spring-cloud-aws-jdbc:jar:1.1.3.RELEASE:compile
[INFO] |     +- com.amazonaws:aws-java-sdk-rds:jar:1.11.18:compile
[INFO] |     \- com.amazonaws:aws-java-sdk-iam:jar:1.11.18:compile
[INFO] +- joda-time:joda-time:jar:2.9.7:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-aws-messaging:jar:1.1.3.RELEASE:compile
[INFO] |  \- org.springframework.cloud:spring-cloud-aws-messaging:jar:1.1.3.RELEASE:compile
[INFO] |     +- com.amazonaws:aws-java-sdk-sns:jar:1.11.18:compile
[INFO] |     \- com.amazonaws:aws-java-sdk-sqs:jar:1.11.18:compile
[INFO] +- org.glassfish.hk2:spring-bridge:jar:2.5.0-b36:compile
[INFO] |  \- org.glassfish.hk2:hk2-api:jar:2.5.0-b36:compile
[INFO] |     \- org.glassfish.hk2:hk2-utils:jar:2.5.0-b36:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:1.4.5.RELEASE:compile
[INFO] |  +- org.eclipse.jetty:jetty-servlets:jar:9.3.16.v20170120:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-continuation:jar:9.3.16.v20170120:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-http:jar:9.3.16.v20170120:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-util:jar:9.3.16.v20170120:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-io:jar:9.3.16.v20170120:compile
[INFO] |  +- org.eclipse.jetty:jetty-webapp:jar:9.3.16.v20170120:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-xml:jar:9.3.16.v20170120:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.3.16.v20170120:compile
[INFO] |  |     \- org.eclipse.jetty:jetty-security:jar:9.3.16.v20170120:compile
[INFO] |  |        \- org.eclipse.jetty:jetty-server:jar:9.3.16.v20170120:compile
[INFO] |  +- org.eclipse.jetty.websocket:websocket-server:jar:9.3.16.v20170120:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-common:jar:9.3.16.v20170120:compile
[INFO] |  |  |  \- org.eclipse.jetty.websocket:websocket-api:jar:9.3.16.v20170120:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-client:jar:9.3.16.v20170120:compile
[INFO] |  |  \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.3.16.v20170120:compile
[INFO] |  \- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.3.16.v20170120:compile
[INFO] |     +- org.eclipse.jetty:jetty-annotations:jar:9.3.16.v20170120:compile
[INFO] |     |  \- org.eclipse.jetty:jetty-plus:jar:9.3.16.v20170120:compile
[INFO] |     +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.3.16.v20170120:compile
[INFO] |     \- javax.websocket:javax.websocket-api:jar:1.0:compile
[INFO] +- com.mercateo.rest:rest-schemagen-spring:jar:0.2.0:compile
[INFO] |  +- com.mercateo:common.rest.schemagen:jar:0.18.15:compile
[INFO] |  |  +- com.mercateo:reflection:jar:1.2.14:compile
[INFO] |  |  |  +- net.bytebuddy:byte-buddy:jar:1.7.11:compile
[INFO] |  |  |  \- org.cache2k:cache2k-core:jar:1.0.2.Final:compile
[INFO] |  |  |     \- org.cache2k:cache2k-api:jar:1.0.2.Final:compile
[INFO] |  |  +- org.reflections:reflections:jar:0.9.11:compile
[INFO] |  |  +- com.googlecode.gentyref:gentyref:jar:1.2.0:compile
[INFO] |  |  \- org.glassfish.jersey.media:jersey-media-multipart:jar:2.25.1:compile
[INFO] |  |     \- org.jvnet.mimepull:mimepull:jar:1.9.6:compile
[INFO] |  \- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-inmemory:jar:2.25.1:test
[INFO] |  +- org.glassfish.jersey.test-framework:jersey-test-framework-core:jar:2.25.1:test
[INFO] |  +- org.glassfish.jersey.core:jersey-server:jar:2.23.2:compile
[INFO] |  |  +- org.glassfish.jersey.core:jersey-common:jar:2.23.2:compile
[INFO] |  |  |  +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.23.2:compile
[INFO] |  |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] |  |  +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.23.2:compile
[INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] |  |  +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b05:compile
[INFO] |  |  \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b05:compile
[INFO] |  \- org.glassfish.jersey.core:jersey-client:jar:2.25.1:compile
[INFO] +- org.assertj:assertj-core:jar:3.10.0:test
[INFO] +- org.json:json:jar:20140107:compile
[INFO] +- io.rest-assured:rest-assured:jar:3.0.6:test
[INFO] |  +- org.codehaus.groovy:groovy:jar:2.4.9:test
[INFO] |  +- org.codehaus.groovy:groovy-xml:jar:2.4.9:test
[INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.5.3:test
[INFO] |  +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:test
[INFO] |  +- io.rest-assured:json-path:jar:3.0.6:test
[INFO] |  |  +- org.codehaus.groovy:groovy-json:jar:2.4.9:test
[INFO] |  |  \- io.rest-assured:rest-assured-common:jar:3.0.6:test
[INFO] |  \- io.rest-assured:xml-path:jar:3.0.6:test
[INFO] |     +- org.apache.commons:commons-lang3:jar:3.4:test
[INFO] |     \- javax.xml.bind:jaxb-api:jar:2.2.12:test
[INFO] +- org.springframework.boot:spring-boot-starter-jersey:jar:1.4.5.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-validation:jar:1.4.5.RELEASE:compile
[INFO] |  +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.23.2:compile
[INFO] |  +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.23.2:compile
[INFO] |  +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.23.2:compile
[INFO] |  +- org.glassfish.jersey.ext:jersey-spring3:jar:2.23.2:compile
[INFO] |  |  \- org.glassfish.hk2:hk2:jar:2.5.0-b05:compile
[INFO] |  |     +- org.glassfish.hk2:config-types:jar:2.5.0-b05:compile
[INFO] |  |     +- org.glassfish.hk2:hk2-core:jar:2.5.0-b05:compile
[INFO] |  |     +- org.glassfish.hk2:hk2-config:jar:2.5.0-b05:compile
[INFO] |  |     +- org.glassfish.hk2:hk2-runlevel:jar:2.5.0-b05:compile
[INFO] |  |     \- org.glassfish.hk2:class-model:jar:2.5.0-b05:compile
[INFO] |  |        \- org.glassfish.hk2.external:asm-all-repackaged:jar:2.5.0-b05:compile
[INFO] |  \- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.23.2:compile
[INFO] |     +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.23.2:compile
[INFO] |     +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.8.7:compile
[INFO] |     \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.8.7:compile
[INFO] |        \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.7:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.5.RELEASE:test
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:test
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:test
[INFO] |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:test
[INFO] +- com.amazonaws:aws-java-sdk-cloudsearch:jar:1.11.18:compile
[INFO] |  \- com.amazonaws:aws-java-sdk-core:jar:1.11.18:compile
[INFO] |     \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.7:compile
[INFO] +- software.amazon.awssdk:cloudsearchdomain:jar:2.0.0-preview-11:compile
[INFO] |  +- software.amazon.awssdk:sdk-core:jar:2.0.0-preview-11:compile
[INFO] |  |  +- software.amazon.ion:ion-java:jar:1.2.0:compile
[INFO] |  |  \- org.reactivestreams:reactive-streams:jar:1.0.2:compile
[INFO] |  +- software.amazon.awssdk:auth:jar:2.0.0-preview-11:compile
[INFO] |  |  \- software.amazon.awssdk:profiles:jar:2.0.0-preview-11:compile
[INFO] |  +- software.amazon.awssdk:http-client-spi:jar:2.0.0-preview-11:compile
[INFO] |  +- software.amazon.awssdk:regions:jar:2.0.0-preview-11:compile
[INFO] |  |  \- com.fasterxml.jackson.jr:jackson-jr-objects:jar:2.9.6:compile
[INFO] |  +- software.amazon.awssdk:annotations:jar:2.0.0-preview-11:compile
[INFO] |  +- software.amazon.awssdk:utils:jar:2.0.0-preview-11:compile
[INFO] |  +- software.amazon.awssdk:aws-core:jar:2.0.0-preview-11:compile
[INFO] |  +- software.amazon.awssdk:apache-client:jar:2.0.0-preview-11:runtime
[INFO] |  \- software.amazon.awssdk:netty-nio-client:jar:2.0.0-preview-11:runtime
[INFO] |     +- io.netty:netty-codec-http:jar:4.1.26.Final:runtime
[INFO] |     +- io.netty:netty-codec:jar:4.1.26.Final:runtime
[INFO] |     +- io.netty:netty-transport:jar:4.1.26.Final:runtime
[INFO] |     |  \- io.netty:netty-resolver:jar:4.1.26.Final:runtime
[INFO] |     +- io.netty:netty-common:jar:4.1.26.Final:runtime
[INFO] |     +- io.netty:netty-buffer:jar:4.1.26.Final:runtime
[INFO] |     +- io.netty:netty-handler:jar:4.1.26.Final:runtime
[INFO] |     +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.26.Final:runtime
[INFO] |     |  \- io.netty:netty-transport-native-unix-common:jar:4.1.26.Final:runtime
[INFO] |     \- com.typesafe.netty:netty-reactive-streams-http:jar:2.0.0:runtime
[INFO] |        \- com.typesafe.netty:netty-reactive-streams:jar:2.0.0:runtime
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.6:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.6:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- io.logz.logback:logzio-logback-appender:jar:1.0.16:compile
[INFO] +- io.github.benas:random-beans:jar:3.7.0:test
[INFO] |  +- org.objenesis:objenesis:jar:2.5.1:compile
[INFO] |  \- io.github.lukehutch:fast-classpath-scanner:jar:2.2.1:test
[INFO] +- com.jsoniter:jsoniter:jar:0.9.15:test
[INFO] +- com.mercateo.rest:rest-jersey-utils:jar:0.0.25:compile
[INFO] |  \- javax.el:javax.el-api:jar:3.0.0:compile
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] +- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] +- org.springframework.retry:spring-retry:jar:1.1.5.RELEASE:compile
[INFO] \- com.fasterxml.jackson.module:jackson-module-jsonSchema:jar:2.8.7:test
[INFO]    \- javax.validation:validation-api:jar:1.1.0.Final:compile

As you can see, httpclient version is 4.5.6. Anything else, you can suggest to me?

apple-corps commented 5 years ago

Hi I recently went from preview-10 to preview-12 for software.amazon.awssdk s3 2.0.0-preview-12

At first had a package path change error: object SdkIterable is not a member of package software.amazon.awssdk.core.pagination val iterable: SdkIterable[S3Object] = listObjectsV2Iterable.contents() Looks like something broke again

colin-williams @colin-williams 14:15

After fixing the import path to import software.amazon.awssdk.core.pagination.sync.SdkIterable then I'm getting the exception:
S3UtilTest  Time elapsed: 1.823 s  <<< ERROR!
java.lang.BootstrapMethodError: call site initialization exception
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type interface org.apache.http.Header; not a subtype of implementation type interface org.apache.http.NameValuePair
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
apple-corps commented 5 years ago

Looks like the suggestion to import http-client resolved the issue:

<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.5</version>
</dependency>

For some reason I thought that amazon provided shaded versions of the dependencies so these types of conflicts don't occur, but maybe that's not the case here...

Andre0711er commented 5 years ago

Hi.

I run in the same Issue. Use "preview-13" and getting this error.

After import/using "httpclient" version 4.5.6 in maven file it works correct. Version 4.5.5 works too.

Strange behaviour...

timmattison commented 5 years ago

I'm seeing this on v2.3.1 of the SDK. Just switched from 2.2.x.

timmattison commented 5 years ago

Importing httpclient 4.5.6 in my Gradle project fixes this. Even more strange is that this only breaks in my debugger, not when I run a fat JAR of the same project.

sammad commented 5 years ago

I am seeing this issue while i try to get list of s3 buckets. Even importing httpclient 4.5.6 does not resolve the issue.


Stack Trace


java.lang.BootstrapMethodError: call site initialization exception at java.lang.invoke.CallSite.makeSite(CallSite.java:341) at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307) at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297) at software.amazon.awssdk.http.apache.ApacheHttpClient.transformHeaders(ApacheHttpClient.java:243) at software.amazon.awssdk.http.apache.ApacheHttpClient.createResponse(ApacheHttpClient.java:228) at software.amazon.awssdk.http.apache.ApacheHttpClient.execute(ApacheHttpClient.java:208) at software.amazon.awssdk.http.apache.ApacheHttpClient.access$500(ApacheHttpClient.java:95) at software.amazon.awssdk.http.apache.ApacheHttpClient$1.call(ApacheHttpClient.java:188) at software.amazon.awssdk.core.internal.http.pipeline.stages.MakeHttpRequestStage.executeHttpRequest(MakeHttpRequestStage.java:66) at software.amazon.awssdk.core.internal.http.pipeline.stages.MakeHttpRequestStage.execute(MakeHttpRequestStage.java:51) at software.amazon.awssdk.core.internal.http.pipeline.stages.MakeHttpRequestStage.execute(MakeHttpRequestStage.java:35) at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205) at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205) at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205) at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205) at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:63) at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:36) at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:77) at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:39) at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.doExecute(RetryableStage.java:115) at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage$RetryExecutor.execute(RetryableStage.java:88) at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:64) at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:44) at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205) at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:51) at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:33) at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.executeWithTimer(ApiCallTimeoutTrackingStage.java:79) at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:60) at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:42) at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205) at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:205) at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:37) at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:26) at software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient$RequestExecutionBuilderImpl.execute(AmazonSyncHttpClient.java:240) at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.invoke(BaseSyncClientHandler.java:96) at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:120) at software.amazon.awssdk.core.client.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:73) at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:44) at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:55) at software.amazon.awssdk.services.s3.DefaultS3Client.listBuckets(DefaultS3Client.java:2029) at software.amazon.awssdk.services.s3.S3Client.listBuckets(S3Client.java:3295) at com.tpt.log_archiver.S3FileArchiver.archiveFiles(S3FileArchiver.java:35) at com.tpt.log_archiver.LogFilePoller.poll(Unknown Source) at com.tpt.log_archiver.LogFilePoller.poll(Unknown Source) at com.tpt.log_archiver.directory_poller.DirectoryPoller.lambda$registerPoller$2(DirectoryPoller.java:99) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type interface org.apache.http.Header; not a subtype of implementation type interface org.apache.http.NameValuePair at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:233) at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303) at java.lang.invoke.CallSite.makeSite(CallSite.java:302) ... 45 more

isikemre commented 5 years ago

I am getting the same error. Even with 4.5.5 and 4.5.6 on AWS-SDK v2.3.6 nothing works

tahoward commented 5 years ago

Getting same error with httpclient 4.5.6 with AWS SDK v2.4.0 using S3Client listBuckets:

    at software.amazon.awssdk.services.s3.S3Client.listBuckets(S3Client.java:3295)
    at com.jenkins.plugin.aws.product.connection.AWSConnection.listBuckets(AWSConnection.java:282)
    at com.jenkins.plugin.aws.product.util.FormUtils.getBucketListBox(FormUtils.java:60)
    at com.jenkins.plugin.aws.product.builder.AWSProductBuildStep$DescriptorImpl.doFillProductBucketItems(AWSProductBuildStep.java:452)
    at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
    ... 64 more
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type interface org.apache.http.Header; not a subtype of implementation type interface org.apache.http.NameValuePair
    at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:233)
    at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
    at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
    ... 109 more
slorinc commented 5 years ago

Make sure you use the BOM when you are working with AWS SDK. I run into similar issues before and using the correct BOM usually fixed it. For example: `

software.amazon.awssdk bom 2.0.0-preview-11 pom import
</dependencyManagement>`
mguillet commented 5 years ago

I'm also having this issue and worked around it by adding explicitly a dependency on software.amazon.awssdk:apache-client in my POM.

<project>

    [...]

    <dependencies>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>apache-client</artifactId>
        </dependency>

        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>s3</artifactId>
        </dependency>

        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>sts</artifactId>
        </dependency>

        [...]
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>2.3.6</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>
tahoward commented 5 years ago

@mguillet Tried this out with no luck. I do have deps in httpcomponents to resolve dependency conflicts for my project:

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.6</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.10</version>
        </dependency>
kharlamov commented 5 years ago

Just wanted to note that I have also experienced this issue with the following dependencies:

mguillet commented 5 years ago

@tahoward have you tried to move higher in your dependency chain the artifact software.amazon.awssdk:apache-client ?

ronreynolds2 commented 5 years ago

i had this exact error with ....s3.paginators.ListObjectsV2Iterable#contents; fixed it by adding

            <exclusions>
                <exclusion>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpclient</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpmime</artifactId>
                </exclusion>
            </exclusions>

to the dependency that was pulling in org.apache.httpcomponents:httpclient:4.5 and org.apache.httpcomponents:httpmime:4.5 and replacing them with

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>LATEST</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>LATEST</version>
        </dependency>

(currently only importing software.amazon.awssdk:s3:2.4.11 from the AWS-SDK family). fixed the problem immediately.

dev-trendrating commented 5 years ago

The problem can be fixed forcing

org.apache.httpcomponents httpcore 4.4.9

From 4.4.9 changelog

abhimanyu4211 commented 5 years ago

The problem can be fixed forcing

org.apache.httpcomponents httpcore 4.4.9

From 4.4.9 changelog

* HTTPCORE-499: Make interface Header extend NameValuePair.

Thanks it worked

rcuhljr commented 5 years ago

Still seeing this issue with 2.5.37 no luck with the specific httpcore 4.4.9 pull in.

dev-trendrating commented 5 years ago

Still seeing this issue with 2.5.37 no luck with the specific httpcore 4.4.9 pull in.

I'm using httpclient 4.5.7 and httpcore 4.4.11 and it works perfectly but is supposed to work from httpcore 4.4.9. The fact that you are still experiencing the issue makes me wonder if you are still deploying an old version of httpcore together with the 4.4.9 so that the run-time is still piking the old one and keep throwing the exception. I can't see any other valid reason. If the run-time pick-up the correct version can't give this exception anymore, by definition, because from 4.4.9 Header is subtype of NameValuePair

stamhankar999 commented 5 years ago

Is there any particular reason that the sdk doesn't declare a dependency on the range of httpcore versions that it relies on (in their pom)? Then maven dependency management would just download the highest version that otherwise works with a user's project (or error out if no common version exists between what I specify in my pom for my project's other needs and the version range supported by the aws sdk). If my project doesn't otherwise rely on httpcore, there's no conflict, and Maven would just include the latest httpcore in the version range specified by the aws sdk.

I've never actually done something like that, so maybe there's a reason why that's not possible. But I thought Maven supported version ranges for cases like this.

I feel like consumers of the sdk shouldn't have to deal with this.

dboitnot commented 5 years ago

I ran into this issue with software.amazon.awssdk:bom:2.5.51 using software.amazon.awssdk:ssm. I wasn't able to resolve it using the exclusion and explicit dependencies described above.

I was able to resolve it by making awssdk first in my <dependencies> section. I was then able to remove the exclusions and explicit dependencies.

cuddihyge commented 5 years ago

forcing 4.4.9 worked for me

cam-masai commented 5 years ago

Still having this issue with software.amazon.awssdk:bom:2.5.51 using software.amazon.awssdk:s3. And even using org.apache.httpcomponents:httpclient:4.5.6 and org.apache.httpcomponents:httpcore:4.4.10 still not work...

dev-trendrating commented 5 years ago

If your code is throwing this exception you are probably deploying an older version of http client, coming transitively from some other dependency, together with the new one and the run-time is picking the old one. If you have only the http-core 4.4.9 or later version in your distribution file is impossible to rise this exception. Check your distribution file, .war or .jar, to be sure that only the correct version of http-core is in there. As said in a previous comment in 4.9.9 and later versions org.apache.http.Header implements the interface org.apache.http.NameValuePair and this excludes the possibility to rise this exception.

Il giorno mer 29 mag 2019 alle ore 12:18 cam-masai notifications@github.com ha scritto:

Still having this issue with software.amazon.awssdk:bom:2.5.51 using software.amazon.awssdk:s3. And even using org.apache.httpcomponents:httpclient:4.5.6 and org.apache.httpcomponents:httpcore:4.4.10 still not work...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aws/aws-sdk-java-v2/issues/652?email_source=notifications&email_token=ABKV365BITZVKS3FQQ5UJ3DPXZJ53A5CNFSM4FOQG662YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWO32II#issuecomment-496876833, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKV362P5NZHW6XDFYWC7TLPXZJ53ANCNFSM4FOQG66Q .

ShwethaVenkatesh commented 4 years ago

Anybody got it solved?? Still facing the same problem even after adding dependency to below artifacts software.amazon.awssdk - 2.9.16 software.amazon.awssdk - sts - 2.9.16 org.apache.httpcomponents - httpclient - 4.5.10 org.apache.httpcomponents - httpcore - 4.4.12

My pom file has no other dependency to httpcomponents.

I am trying to use STS service for on boarding and I get LambdaConversionException @resolveCredentials

StsClient stsClient = StsClient.builder().credentialsProvider(sp_StaticCredentialsProvider).build();
StsAssumeRoleCredentialsProvider assumeRoleCredentialProvider = 
                    StsAssumeRoleCredentialsProvider.builder()
                    .stsClient(stsClient)
                    .refreshRequest(assumeRoleRequest)
                    .build();
AwsCredentials clientCredentials = assumeRoleCredentialProvider.resolveCredentials();
dev-trendrating commented 4 years ago

My previous answers gives the definitive solution to this problem. Step to fix it once and for all

  1. Move http-core 4.4.9 or later version
  2. Prevent any transitive dependency on http-core versions
  3. Check your distribution file, .war or .jar, to be sure that only the correct version of http-core is in there. If all these steps have been done, no way to get this error any more Why we need previous steps? In 4.9.9 and later versions org.apache.http.Header implements the interface org.apache.http.NameValuePair and this excludes the possibility to rise this exception.
rhymed-l commented 4 years ago

2019-12-20 03:51:12.488 WARN 29453 --- [nio-8271-exec-1] s.a.a.h.a.internal.utils.ApacheUtils : NoSuchMethodException was thrown when disabling normalizeUri. This indicates you are using an old version (< 4.5.8) of Apache http client. It is recommended to use http client version >= 4.5.9 to avoid the breaking change introduced in apache client 4.5.7 and the latency in exception handling. See https://github.com/aws/aws-sdk-java/issues/1919 for more information

debora-ito commented 4 years ago

Hi @alxgrk, this has been quiet for a while now, have you got it working?

Is anyone still experiencing this issue? If so, check your environment for conflicting versions of httpclient by running mvn dependency:tree. Reach out if you have further questions.

alxgrk commented 4 years ago

Hey @debora-ito, unfortunately i've never got it working... I don't even remember in detail, but i think i just used a totally different approach to solve my problem.

From my side, this issue can be closed, since there are some suggested solutions.

debora-ito commented 4 years ago

Closing this, feel free to reopen if any further questions come up.

Baratam commented 4 years ago

hi, i would like to re-open this issue, as we are encountering the same issue even after trying with all the above suggestions. the concerned aws support engineer suggested to reopen this case, i will upload the screen shots & errors in couple of hours.

tnine commented 4 years ago

I'm also experiencing this issue when using version 2.13.29 utilizing the dynamodb and the dynamodb-enhanced packages.

Fails:

 <!-- AWS Only pull in the Dynamo library-->
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>dynamodb</artifactId>
            <version>2.13.29</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>dynamodb-enhanced</artifactId>
            <version>2.13.29</version>
        </dependency>

Running mvn dependency:tree, I am given this output for my dependencies

+- software.amazon.awssdk:dynamodb:jar:2.13.29:compile
[INFO] |  +- software.amazon.awssdk:aws-json-protocol:jar:2.11.14:compile
[INFO] |  +- software.amazon.awssdk:protocol-core:jar:2.11.14:compile
[INFO] |  +- software.amazon.awssdk:profiles:jar:2.11.14:compile
[INFO] |  +- software.amazon.awssdk:sdk-core:jar:2.11.14:compile
[INFO] |  +- software.amazon.awssdk:auth:jar:2.11.14:compile
[INFO] |  |  \- software.amazon.eventstream:eventstream:jar:1.0.1:compile
[INFO] |  +- software.amazon.awssdk:http-client-spi:jar:2.11.14:compile
[INFO] |  +- software.amazon.awssdk:regions:jar:2.11.14:compile
[INFO] |  +- software.amazon.awssdk:annotations:jar:2.11.14:compile
[INFO] |  +- software.amazon.awssdk:utils:jar:2.11.14:compile
[INFO] |  +- software.amazon.awssdk:aws-core:jar:2.11.14:compile
[INFO] |  +- software.amazon.awssdk:apache-client:jar:2.11.14:runtime
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.5.10:runtime

Overriding to 4.4.9 as suggested resolves the issue.

 <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>dynamodb</artifactId>
            <version>2.13.29</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>dynamodb-enhanced</artifactId>
            <version>2.13.29</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.9</version>
        </dependency>
HuKongJ commented 3 years ago

My previous answers gives the definitive solution to this problem. Step to fix it once and for all

  1. Move http-core 4.4.9 or later version
  2. Prevent any transitive dependency on http-core versions
  3. Check your distribution file, .war or .jar, to be sure that only the correct version of http-core is in there. If all these steps have been done, no way to get this error any more Why we need previous steps? In 4.9.9 and later versions org.apache.http.Header implements the interface org.apache.http.NameValuePair and this excludes the possibility to rise this exception.

it worked

HuKongJ commented 3 years ago

I tried many times and found that it was a jar package conflict

mvillafuertem commented 3 years ago

same error. Any workaround? Thanks


software.amazon.awssdk - sts - 2.16.83
org.apache.httpcomponents - httpclient - 4.5.13
org.apache.httpcomponents - httpcore - 4.4.13
WARN software.amazon.awssdk.http.apache.internal.utils.ApacheUtils - NoSuchMethodException was thrown when disabling normalizeUri. This indicates you are using an old version (< 4.5.8) of Apache http client. It is recommended to use http client version >= 4.5.9 to avoid the breaking change introduced in apache client 4.5.7 and the latency in exception handling. See https://github.com/aws/aws-sdk-java/issues/1919 for more information
...
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type interface org.apache.http.Header; not a subtype of implementation type interface org.apache.http.NameValuePair
dev-trendrating commented 3 years ago

According to Apache change-log after 4.4.9 interface org.apache.http.Header implements interface org.apache.http.NameValuePair https://downloads.apache.org/httpcomponents/httpcore/RELEASE_NOTES-4.4.x.txt Analize your distributed JAR or WAR(open with on archive manager) and exclude that for some transitive dependency you are distributing an old version along with the ones you are mentioning

joy45689 commented 2 years ago

I set the version of httpcore and httpclient in the <dependencyManagement>, but it didn't work.

After that, I checked my local Maven repository. I found there are many version of httpcore and httpclient in my local repository. (under <pathToYourMavenRepository>\org\apache\httpcomponents\httpcore and \httpclient)

I removed the folder of httpcore and httpclient and reloaded Maven dependencies of my project. The folder of httpcore and httpclient showed up, with the correct version inside.

Problem solved!!

    <dependencies>
        <!--AWS SDK-->
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>s3</artifactId>
        </dependency>
    </dependencies>
...
    <dependencyManagement>
        <dependencies>
            <!--      AWS SDK Java v2-->
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>2.17.46</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpcore</artifactId>
                <version>4.4.11</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.5.13</version>
            </dependency>
    </dependencyManagement>