aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

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

Open alxgrk opened this issue 8 years ago • 42 comments

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

  • AWS Java SDK version used: 2.0.0-preview-11
  • JDK version used: jdk1.8.0_131
  • Maven version: Apache Maven 3.5.4
  • Spring-Boot version: 1.4.5.RELEASE
  • Spring-Cloud version: Camden.SR5
  • Operating System and version: OS name: "linux", version: "4.13.0-46-generic", arch: "amd64", family: "unix"

Looking forward to an answer and thanks in advance, Alex

alxgrk avatar Aug 08 '18 14:08 alxgrk

I have the same problem with S3Client.getObject @alxgrk

ArturSkowronski avatar Aug 27 '18 16:08 ArturSkowronski

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.

Initial-B avatar Sep 19 '18 15:09 Initial-B

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

vbudilov avatar Sep 26 '18 03:09 vbudilov

@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.

alxgrk avatar Oct 04 '18 07:10 alxgrk

@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.

dagnir avatar Oct 04 '18 17:10 dagnir

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?

alxgrk avatar Oct 05 '18 06:10 alxgrk

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 avatar Oct 11 '18 21:10 apple-corps

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...

apple-corps avatar Oct 11 '18 21:10 apple-corps

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...

Andre0711er avatar Nov 15 '18 09:11 Andre0711er

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

timmattison avatar Jan 14 '19 21:01 timmattison

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.

timmattison avatar Jan 14 '19 21:01 timmattison

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

sammad avatar Jan 17 '19 12:01 sammad

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

isikemre avatar Jan 22 '19 12:01 isikemre

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

tahoward avatar Feb 05 '19 18:02 tahoward

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: <dependencyManagement> <dependencies> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>bom</artifactId> <version>2.0.0-preview-11</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>

slorinc avatar Feb 11 '19 16:02 slorinc

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>

mguillet avatar Feb 12 '19 12:02 mguillet

@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>

tahoward avatar Feb 12 '19 17:02 tahoward

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

  • org.apache.httpcomponents:httpclient:4.5.7 or org.apache.httpcomponents:httpclient:4.5.6
  • for: software.amazon.awssdk:ssm:2.4.4/software.amazon.awssdk:s3:2.4.4

kharlamov avatar Feb 12 '19 18:02 kharlamov

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

mguillet avatar Feb 18 '19 10:02 mguillet

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.

ronreynolds2 avatar Feb 20 '19 17:02 ronreynolds2