[SOLVED] Getting Unmarshall exception while putting data in dynamo db table in spring boot


This Content is from Stack Overflow. Question asked by Siddharth Bhatia

I am trying to integrate dynamo db to my spring boot application I have been following this [link][1] to implement the dynamo db into my spring boot application ever time I try to put into my table I get this error “Unable to unmarshall exception response with the unmarshallers provided“.I have created my dynamo db table manually by using aws console
I have mentioned my code below


public class EmployeeController {
    private EmployeeRepository employeeRepository;

    public String data(Employee employee){
        return employeeRepository.updateData(employee);


public class EmployeeRepository {
    public String updateData(Employee employee) {

        AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().build();

        DynamoDB dynamoDB = new DynamoDB(client);

        Table table = dynamoDB.getTable("employee");

        Item item = new Item()
                .withPrimaryKey("employeeId", "1")
                .withString("firstName", "micky")
                .withString("lastName", "mouse")
                .withString("emailId", "mic@gmail.com");
        return "OK";

DynamoDB config

public class DynamoDBConfiguration {
    public DynamoDBMapper dynamoDBMapper(){
        return new DynamoDBMapper(buildAmazonDynamoDb());

    private AmazonDynamoDB buildAmazonDynamoDb() {
        return AmazonDynamoDBClientBuilder
                new AwsClientBuilder.EndpointConfiguration("dyno-config")
                .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(


public class Employee {
    public String employeeId;
    public String firstName;
    public String lastName;
    public String emailId;

The values mentioned in employee entity are of same name as of mu dynamoDB entity.Can anyone help me out what is wrong with my code
[1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaDocumentAPIItemCRUD.html


You are using old V1 code. That is not best practice. Look at this section in the same guide that uses DynamoDbClient.


This link uses the AWS SDK for Java V2 and shows you how to successfully develop a Spring REST API that queries Amazon DynamoDB data.

This Question was asked in StackOverflow by Siddharth Bhatia and Answered by smac2020 It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?