Reputation: 1215
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?
Upvotes: 13
Views: 22877
Reputation: 1
I am little late to party but I faced the similar issue turns out the issue was due to duplicate dependencies. I added the same dependencies mentioned below that were already present in other module (Library Code) to my repos.
<dependency>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-starter</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-sqs</artifactId>
<version>3.0.1</version>
</dependency>
Simply removing the dependencies from my repo did the trick, hope that helps.
Upvotes: 0
Reputation: 81
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>
Upvotes: 3
Reputation: 1412
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.
The versions in the above 2 places should match and then it started working
Upvotes: 1
Reputation: 197
I had different version for SQS and S3 in pom.xml. After I updated those to same versions, it worked.
Upvotes: 1
Reputation: 1215
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
Upvotes: 13