gpt4 book ai didi

amazon-web-services - AWS SES 服务用于使用 java 发送邮件

转载 作者:行者123 更新时间:2023-12-01 10:19:59 27 4
gpt4 key购买 nike

我在使用 AWS SES 邮件发送示例时遇到以下错误?

"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)
"

最佳答案

问题:

我也遇到了同样的问题。原因是我为我的 aws 库使用了不同的人工制品版本:aws-java-sdk-core 和 aws-java-sdk-s3。

解决方案(Maven):

如果您使用 Maven,亚马逊建议使用 BOM 依赖管理。这样可以确保您指定的模块使用相同版本的 SDK,并且它们相互兼容。

<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>

由于您已经在 BOM 中声明了 SDK 版本,因此您无需为每个组件指定版本号。像这样:

<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>

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

关于amazon-web-services - AWS SES 服务用于使用 java 发送邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53570061/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com