AWS SDK v2 STS - BootstrapMethodError: call site initialization exception caused by LamdaConversionException

Viewed 1389

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();

I have 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

Exception Stacktrace

Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception
    at software.amazon.awssdk.services.sts.auth.StsCredentialsProvider.resolveCredentials(StsCredentialsProvider.java:78)
    at software.amazon.awssdk.services.sts.auth.StsAssumeRoleCredentialsProvider.resolveCredentials(StsAssumeRoleCredentialsProvider.java:42)
    at com.silverpeak.gms.server2.manager.thirdPartyTunnels.AWSGlobalInterconnectTest.main(AWSGlobalInterconnectTest.java:43)
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

Appreciate any help.

2 Answers

Upgrade to the latest verion of httpcore

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

I'm sure op must have solved it by now, posting it here for others in same boat.

I had a similar issue. In my case, it was due to the httpclient and httpcore dependencies version conflict. After resolving the version conflict, it solved the issue

Related