- Newest
- Most votes
- Most comments
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.
Relevant content
- asked a year ago
- asked a year ago
- asked 10 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago