'java.lang.NoSuchFieldError: CLIENT_ENDPOINT for Amazon ECS

I tried to list the ECS clusters using the code as follow:

AmazonECS = amazonECS AmazonECSClientBuilder.standard().withRegion(region).withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build():
amazonECS.listClusters();

However, it gave the error

java.lang.NoSuchFieldError: CLIENT_ENDPOINT

The error stack is something like this:

com.amazonaws.services.ecs.AmazonECSClient in executeListClusters at line 2220 com.amazonaws.services.ecs.AmazonECSClient in listClusters at line 2202 com.amazonaws.services.ecs.AmazonECSClient in listClusters at line 2245

I am not too sure why this error occurred as the other Amazon services did not give me any similar error whatsoever and I have set the region previously based on the client's preference. Any ideas?



Solution 1:[1]

Thanks to Nagaraj Trantri the error is caused by the version mismatched of the AWS SDK that I have according to https://github.com/aws/aws-sdk-java/issues/2509#issuecomment-779370672

Solution 2:[2]

I had different version for SQS and S3 in pom.xml. After I updated those to same versions, it worked.

Solution 3:[3]

It depends on where to look for these versions mismatch.

I am using spark to connect to secrets manager and thus we have 2 places to look at.

  1. My Application dependencies (build.gradle)
  2. spark.yarn.jars

The versions in the above 2 places should match and then it started working

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ihsan Haikal
Solution 2 nats
Solution 3 newbie