I am using aws-java-sdk-sqs dependency to read messages from SQS and for the project reasons we are relocating AWS dependencies to different package structure inside final jar using :
<relocation>
<pattern>com.amazonaws</pattern>
<shadedPattern>com.shaded.amazonaws</shadedPattern>
</relocation>
I am creating SQS client with code
AmazonSQS amazonSQS = AmazonSQSClientBuilder.standard().withRegion(region).build();
I am getting error with this code :
com.shaded.amazonaws.AmazonClientException: Unable to instantiate request handler chain for client: Unable to instantiate request handler chain for client. Listed request handler ('com.amazonaws.services.sqs.QueueUrlHandler') does not implement the interface com.shaded.amazonaws.handlers.RequestHandler API.
UPDATE------------------------------------------------------------------------------>
Cause :
This issue is because of
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/sqs/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/sqs/request.handler2s"));
These file 'request.handlers' contains fully qualified handler names. Which maven shade plugin has not take care of while relocating.
Is there any way we can relocate these files as well with the help of maven? Or any other workaround, anybody has find out?
I have updated the final jar file using this command, in the build pipeline as soon as maven build section complete.
jar uf jar-file input-file(s)
I have placed a edited 'request.handlers' at the build server and replaced the existing inside jar using this command.
https://docs.oracle.com/javase/tutorial/deployment/jar/update.html