Search code examples
javaamazon-ecs

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

  • 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