While working with Java, Jackson’s ObjectMapper launches a
com.fasterxml.jackson.databind.exc.InvalidDefinitionException. While trying to read JSON content into a class that declares constructors with arguments.
InvalidDefinitionException is intermediate exception which is used as the base class for all JsonMappingExceptions that occurred due to problems with target type definition.
The following Exception is caused when the data from the JSON is not mapped properly to a data type in Java.
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Invalid type definition for type
The Following exception that has occurred can be solved by adding the following line of code below the object mapper definition.
ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule());
Adding the following code makes the data from Trades.json file compatible with the LocalDate parsing.
This Exception is also raised when a POJO Class constructor is declared with no arguments.