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



我们的遗留java web应用程序运行在aws弹性beanstall上,它承担IAM角色来访问SES。今天,在将弹性豆茎环境从Tomcat7升级到Tomcat8,并将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作为环境变量,但没有成功。搜索了网页,查看了aws文档,但没有任何运气。

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

相关内容

最新更新