question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

S3AsyncClient- SdkClientException: Unable to instantiate executor interceptor for client

See original GitHub issue

Expected Behavior

When running S3AsyncClient s3AsyncClient = S3AsyncClient.create(); In AWS lambda function, got following exception:

Current Behavior

software.amazon.awssdk.core.exception.SdkClientException: Unable to instantiate executor interceptor for client. at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:97) at software.amazon.awssdk.core.interceptor.ClasspathInterceptorChainFactory.createExecutionInterceptor(ClasspathInterceptorChainFactory.java:140) at software.amazon.awssdk.core.interceptor.ClasspathInterceptorChainFactory.createExecutionInterceptorFromResource(ClasspathInterceptorChainFactory.java:95) at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at software.amazon.awssdk.core.interceptor.ClasspathInterceptorChainFactory.createExecutionInterceptorsFromClasspath(ClasspathInterceptorChainFactory.java:64) at software.amazon.awssdk.core.interceptor.ClasspathInterceptorChainFactory.getInterceptors(ClasspathInterceptorChainFactory.java:51) at software.amazon.awssdk.services.s3.DefaultS3BaseClientBuilder.finalizeServiceConfiguration(DefaultS3BaseClientBuilder.java:57) at software.amazon.awssdk.awscore.client.builder.AwsDefaultClientBuilder.finalizeChildConfiguration(AwsDefaultClientBuilder.java:133) at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.asyncClientConfiguration(SdkDefaultClientBuilder.java:170) at software.amazon.awssdk.services.s3.DefaultS3AsyncClientBuilder.buildClient(DefaultS3AsyncClientBuilder.java:28) at software.amazon.awssdk.services.s3.DefaultS3AsyncClientBuilder.buildClient(DefaultS3AsyncClientBuilder.java:22) at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:119) Caused by: java.lang.ClassNotFoundException: software.amazon.awssdk.services.s3.internal.handlers.EndpointAddressInterceptor at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at software.amazon.awssdk.core.internal.util.ClassLoaderHelper.loadClass(ClassLoaderHelper.java:112) at software.amazon.awssdk.core.internal.util.ClassLoaderHelper.loadClass(ClassLoaderHelper.java:71) at software.amazon.awssdk.core.interceptor.ClasspathInterceptorChainFactory.createExecutionInterceptor(ClasspathInterceptorChainFactory.java:123)

Steps to Reproduce (for bugs)

Below is my AWS lambda function written in Java:

private S3AsyncClient s3AsyncClient;    
public CommandsHandler() {
        s3AsyncClient = S3AsyncClient.create();
}

tried latest version of 2.10.3 in my POM file

<dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>dynamodb</artifactId>
            <version>${aws.sdk.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>sns</artifactId>
            <version>${aws.sdk.version}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>s3</artifactId>
            <version>${aws.sdk.version}</version>
        </dependency>

Context

I am able to instantiate SNS client and DynamoDB client without any problem, but S3 Client failed.

Your Environment

  • AWS Java SDK version used: tried 2.10.3, 2.8.7 and 2.5.3
  • JDK version used: 1.8
  • Operating System and version: Ubuntu 18.04.3 LTS and Amazon Linux workspace

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
MarkusKramercommented, Nov 25, 2019

@shanegu you don’t have to disable jar minimizing. you can work around it with

                <configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                    <minimizeJar>true</minimizeJar>
                    <filters>
                        <filter>
                            <artifact>software.amazon.awssdk:s3</artifact>
                            <includes>
                                <include>**</include>
                            </includes>
                        </filter>
                    </filters>
                </configuration>

or by explicitly including all classes listed in “execution.interceptors” in your code like EnableTrailingChecksumInterceptor.class.toString()

It would be nice if the AWS SDK would not dynamically load these classes. It makes live with tools that need to statically analyze your code (like the shade plugin or graal’s native image tool) so much easier.

1reaction
shanegucommented, Nov 13, 2019

@zoewangg sorry for late response as well, I found the issue: I ran: find . -name *.jar -print0 | xargs -0 -I '{}' sh -c 'jar tf {} | grep EndpointAddressInterceptor.class && echo {}' Indeed I didn’t find the class, I had maven shade plugin to minimize the jar file, so it was excluded, the reason I had to do this is the cold start issue when using java and I tried to minimize jar file and didn’t expect some of packages from s3 will be excluded, after I unset minimize the jar file in pom, it worked. I did notice my cold start time increased from 5.5 second to 6.5 second and jar file size increased by 4 MB. Closing this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to overcome AWS V1 + V2 mismatch while using Java ...
SdkClientException Cause { "errorMessage": "Unable to instantiate executor interceptor for client.
Read more >
aws/aws-sdk-java-v2 - Gitter
I use it to load json for tests and I can't figure out how to do it in the new ... Question: in...
Read more >
S3AsyncClient (AWS SDK for Java - 2.18.35)
Can be used for catch all scenarios. SdkClientException If any client side error occurs such as an IO related failure, failure to get...
Read more >
Amazon S3 Client :: Quarkiverse Documentation - GitHub Pages
Configuration property Type Default boolean false string localstack AWS SDK client configurations Type Default
Read more >
software.amazon.awssdk.core.exception.SdkClientException
byte[] hash(InputStream input) throws SdkClientException { try { MessageDigest md ... .message("Unable to instantiate execution interceptor chain.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found