- 最新
- 投票最多
- 评论最多
Hi Mr R, From what I can understand of your code and output, I can see that you have successfully printed out the list of table names that you have as the output before the Exception shows:
Client Name : com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient@58359ebd {TableNames: [Automation],} Dynamo DB Table Name : {Automation: null}
This shows your initial DynamoDB client initialization has worked and you have connected to DynamoDB and returned something. Digging further I can see that under "main" you are then initializing another DynamoDB client:
AmazonDynamoDB dynamoDBClient = AmazonDynamoDBClientBuilder
.standard()
.withRegion("AP_SOUTH_1")
.build();
This initialization is missing .withCredentials which I believe is causing your exception. You also already have a DynamoDB client initialized in "initializeDynamoDBClient()" so there is no need to initialize a new client. I haven't gone through the rest of your code to check if it works, but to make progress I recommend changing the start of your main function to:
public static void main(String[] args) {
AmazonDynamoDB dynamoDBClient = initializeDynamoDBClient();
System.out.println(dynamoDBClient.listTables());
// Delete unneccessary call to AmazonDynamoDBClientBuilder
// Continue from here with your getItem query
and continue from there.
There's also good documentation on Querying tables using Java with the DynamoDB SDK that should help you get your code running successfully.
相关内容
- AWS 官方已更新 6 个月前
- AWS 官方已更新 2 年前
- AWS 官方已更新 1 年前