1

When I used enhanced client to put but it throws class cast exception.

DynamoDbTable<Tableclass> recordTable = enhanceClient.table(tableName, Tableclass.class);

Tableclass tableclass = new Tableclass();
tableclass.setid(1);
tableclass.setname("myname");
recordTable.putItem(tableclass);

It gives me error java.lang.ClassCastException: com.db.dynamo.Tableclass cannot be cast to com.db.dynamo.Tableclass

2
  • I'm getting the same issue with aws sdk version 2.16.45. Did you ever figure this out? Commented May 7, 2021 at 14:22
  • 1
    In my case, this post regarding spring devtools solved my problem: stackoverflow.com/a/64350067/1612280 Commented May 7, 2021 at 14:31

1 Answer 1

3

This worked for me SpringBoot - Java AWS SDK 2 DynamoDB Enhanced Client and devtools problem

So basically the issue was with spring dev tools and its class loader(2 in number), so you can either remove it or move dynamo to the same class loader.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.