3

I am facing below error while using AWS SES Mail sending example?

"Exception in thread "main" java.lang.NoSuchMethodError: com.amazonaws.client.AwsSyncClientParams.getAdvancedConfig()Lcom/amazonaws/client/builder/AdvancedConfig;
    at com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient.<init>(AmazonSimpleEmailServiceClient.java:277)
    at com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient.<init>(AmazonSimpleEmailServiceClient.java:261)
    at com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClientBuilder.build(AmazonSimpleEmailServiceClientBuilder.java:61)
    at com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClientBuilder.build(AmazonSimpleEmailServiceClientBuilder.java:27)
    at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)
    at saurabh.aws.learning.awsLearning.SendMailService.main(SendMailService.java:50)
"
John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Saurabh Gupta
  • 129
  • 1
  • 2
  • 5

3 Answers3

6

Problem:

I also faced same issue. The reason was that I was using difference artefact versions for my aws libraries: aws-java-sdk-core and aws-java-sdk-s3.

Solution (Maven):

In case you are using Maven, Amazon suggests to use BOM dependencyManagement. This way you ensure that the modules you specify use the same version of the SDK and that they're compatible with each other.

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

And as you already declared the SDK version in the BOM, you don't need to specify the version number for each component. Like this:

<dependencies>
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-s3</artifactId>
  </dependency>
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-sqs</artifactId>
  </dependency>
</dependencies>

Source: https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-project-maven.html#configuring-maven-individual-components

Fabio Farath
  • 489
  • 6
  • 12
1

I have experienced this error myself. It is caused most likely by different versions of artifacts like: aws-java-sdk-ses and aws-java-sdk-core. Try using the same version for the two above in your pom.xml (if you are using maven). If this doesnt work, can you share your pom.xml ?

lost in binary
  • 544
  • 1
  • 4
  • 11
1

Even i had the same issue :

Exception in thread "main" java.lang.NoSuchMethodError: com.amazonaws.client.AwsSyncClientParams.getAdvancedConfig()Lcom/amazonaws/client/builder/AdvancedConfig;

I tried configuring auto-scaling for my DynamoDB from java i faced this issue.

Solution:

We need to make sure aws sdk version match with the specific service version. I used below dependency when i got exception,

compile group: 'com.amazonaws', name: 'aws-java-sdk-applicationautoscaling', version: '1.11.500'
compile group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.11.123'

After changing to same version, issue got solved

compile group: 'com.amazonaws', name: 'aws-java-sdk-applicationautoscaling', version: '1.11.500'
compile group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.11.500'
Mikev
  • 2,012
  • 1
  • 15
  • 27
  • 1
    in my case, I had upgraded from java 8 to java 11 and previously I had not specified `aws-java-sdk-core` as a dependency, adding that with the correct version helped me – ArcX Mar 04 '20 at 13:08