Reputation: 131
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)
"
Upvotes: 4
Views: 6287
Reputation: 487
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>
Upvotes: 6
Reputation: 505
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'
Upvotes: 1
Reputation: 562
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 ?
Upvotes: 1