I have the following code with the following maven import:
From pom.xml:
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sqs</artifactId>
<version>2.14.23</version>
</dependency>
Code: (Note this is AWS V2)
SqsClient sqs = SqsClient.builder()
.region(Region.US_EAST_1)
.build();
The rest of my AWS code and imports are using V1. There are no issues when I run this code locally but when I execute it through Lambda --> step function, I get the following exception:
Error software.amazon.awssdk.core.exception.SdkClientException Cause { "errorMessage": "Unable to instantiate executor interceptor for client.", "errorType": "software.amazon.awssdk.core.exception.SdkClientException", "stackTrace": [ "software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:98)", "software.amazon.awssdk.core.interceptor.ClasspathInterceptorChainFactory.createExecutionInterceptor(ClasspathInterceptorChainFactory.java:140)", "software.amazon.awssdk.core.interceptor.ClasspathInterceptorChainFactory.createExecutionInterceptorFromResource(ClasspathInterceptorChainFactory.java:95)", "java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)", "java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384)", "java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)", "java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)", "java.util.stream.ReduceOps$ReduceOp.evaluate Sequential(ReduceOps.java:708)", "java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)... ], "cause": { "errorMessage": "software.amazon.awssdk.services.sqs.internal.MessageMD5ChecksumInterceptor. Current classpath: file:/var/task/", "errorType": "java.lang.ClassNotFoundException", "stackTrace": [] } }
I am using maven shaded plugin in order to reduce my JAR size, however, when I run this code locally it works without any issues. Any idea how to resolve this?
Thank you @Susan Mustafa for directing me to the solution and @Parsifal for you assistant.
As Susan links suggested, I resolved the issue by adding a filter to my maven shade plugin as such:
<filter>
<artifact>software.amazon.awssdk:sqs</artifact>
<includes>
<include>**</include>
</includes>
</filter>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.