Solving JsonMappingException error in Fasterxml Jackson

1 minute read

dist files Photo by Adam Gman on Unsplash

In this article, I am going to explain a bug that I had to solve in an application that is responsible for saving data in a non-relational database.

The problem

This API is responsible for processing data sent by a third party and stores it in a non-relational database. This third party sends the information to this REST API through webhooks that periodically send statistical data.

dist files

Well, one of the fields that this third party sends is a numeric value that was bigger than the value that the API expects (that in this case was an Integer). This implies that when receiving the data at the endpoint it would give the following error:

com.fasterxml.jackson.databind.JsonMappingException: Numeric value (1657567761206) out of range of int

The solution

The solution to the problem was to change the data type from Integer to Long. This way the error disappeared and the API could save the data back to the non-relational database.

dist files

This happened because this third party sent the data using an Integer and then without prior notice, they changed the data type to a Long.

How did I catch the error?

I realized that there was an error in the application logs using Kibana. Also, because there was no data in the metrics as previously and this triggered an alarm that it’s configured by Grafana (read this post that I wrote some time ago if you want to know more) that sends a warning to a Slack channel.


In this article we have seen a bug that was in production and how when doing the fix in the API it was possible to process the data as before.

I won't give your address to anyone else, won't send you any spam, and you can unsubscribe at any time.
Disclaimer: Opinions are my own and not the views of my employer