无法加载从/AwsCredentials.properties文件AWS凭据的类路径 [英] Unable to load AWS credentials from the /AwsCredentials.properties file on the classpath

查看:3504
本文介绍了无法加载从/AwsCredentials.properties文件AWS凭据的类路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用这个code设置类路径

Using this code for setting the class path

AWSCredentialsProvider credentialsProvider = new ClasspathPropertiesFileCredentialsProvider();
ec2 = new AmazonEC2Client(credentialsProvider);

下面是AwsCredentials.properties文件的格式

Below is the format for AwsCredentials.properties file

# Fill in your AWS Access Key ID and Secret Access Key
# http://aws.amazon.com/security-credentials
accessKey = keyHere
secretKey = secretKeyHere

下面是例外,我正在

Below is the exception I am getting

Exception in thread "main" com.amazonaws.AmazonClientException: Unable to load AWS credentials from the /AwsCredentials.properties file on the classpath

    at com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider.getCredentials(ClasspathPropertiesFileCredentialsProvider.java:81)
    at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:8359)

请指导我怎样才能解决这个exception.Thanks

Kindly guide me how can I solve this exception.Thanks

推荐答案

您收到此异常,因为您的AWS SDK是无法加载您的凭据。 你应该做的是转到preferences然后转到AWS,并添加你的密钥和访问密钥。所以,你的项目能够取得这两个键。

You are getting this exception because your AWS SDK is unable to load your credentials. What you should do is goto Preferences then goto AWS and add your secret key and access key. So that your project can retrieve both keys .

我希望这可以帮助。

这篇关于无法加载从/AwsCredentials.properties文件AWS凭据的类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆