Recently whilst developing a Spring Boot app, I ran across the following error after adding a new AWS SDK SES maven dependency:
java.lang.NoSuchFieldError: ENDPOINT_OVERRIDDEN at com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient.executeSendEmail(AmazonSimpleEmailServiceClient.java:3845) ~[aws-java-sdk-ses-1.11.905.jar:na] at com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient.sendEmail(AmazonSimpleEmailServiceClient.java:3827) ~[aws-java-sdk-ses-1.11.905.jar:na]
The error is caused by AWS SDK dependency mismatch.
In the Spring Boot application, I had maven dependencies for EC2 and Secrets Manager as well as the SES dependency.
Each of these dependencies will pull in a different version of the
aws-java-sdk-core dependency. This results in the error above because your project will now be running different versions of the AWS core module.
To solve this issue, you must add the following BOM (bill of materials) into your POM file.
The BOM takes care of managing the version of the dependencies that are imported.
<dependencyManagement> <dependencies> <dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk-bom</artifactId> <version>1.11.907</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
Once added remove all the version numbers of the individual AWS maven dependencies, as the BOM module will take care of the versioning for us.