Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 376
Ihsan Haikal Avatar asked Jan 25 '26 15:01

Ihsan Haikal


2 Answers

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

like image 120
Ihsan Haikal Avatar answered Jan 28 '26 06:01

Ihsan Haikal


Use this in the pom.xml file. Error is caused due to mismatch in the 'com.amazonaws' dependency versions declared in the pom.

 <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-bom</artifactId>
        <version>1.11.739</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-sts</artifactId>
    </dependency>
  </dependencies>
like image 28
RV_Mule Avatar answered Jan 28 '26 04:01

RV_Mule



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!