繁体   English   中英

升级到 tomcat 8.5 后无法从链中的任何提供商加载 AWS 凭证

[英]Unable to load AWS credentials from any provider in the chain after upgrading to tomcat 8.5

我们的遗留 java web 应用程序在 aws elastic beanstalk 上运行,它承担 IAM 角色来访问 SES。 今天将elastic beanstalk环境从Tomcat 7升级到Tomcat 8,将spring库从3.2.1升级到4.0.0后,SES客户端停止工作。 下面是直到昨天还可以正常发送电子邮件的代码:

AmazonSimpleEmailService client = AmazonSimpleEmailServiceClientBuilder.standard()
                    .withCredentials(com.amazonaws.auth.DefaultAWSCredentialsProviderChain.getInstance())
                    .withRegion(Regions.US_EAST_1).build();

它抛出以下异常

SEVERE [http-nio-8080-exec-8] The email was not sent.
    com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), com.amazonaws.auth.profile.ProfileCredentialsProvider@79fc4ef8: profile file cannot be null, com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@33e618b9: Unauthorized (Service: null; Status Code: 401; Error Code: null; Request ID: null)]

我也尝试将AWS_ACCESS_KEY_IDAWS_SECRET_KEY添加为环境变量,但没有成功。 搜索 web,检查 aws 文档但没有任何运气。

我通过升级到最新的 AWS SDK 版本解决了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM