I'm trying to deserialize an object using Kafka inside a Quarkus Project JDK-17. But It simply won't work. I was having the same issue when serializing the message inside the same project, but using ObjectMapper().registerModule(new JavaTimeModule());
solved the issue.
Now that I need to consume the same object, inside the same project, It won't work. I've I already tried the following:
new ObjectMapper().registerModule(new JavaTimeModule());
mapper.readValue(data, BudgetToMarinaOrderDTO.class);
2:
new ObjectMapper().registerModule(new JavaTimeModule()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.readValue(data, BudgetToMarinaOrderDTO.class);
3:
Gson gson = new GsonBuilder().create();
gson.fromJson(data, BudgetToMarinaOrderDTO.class);
4:
gsonBuilder.registerTypeAdapter(LocalDateTime.class, new CustomLocalDateTimeDeserializer());
Gson gson = gsonBuilder.setPrettyPrinting().create();
gson.fromJson(data, BudgetToMarinaOrderDTO.class);
These are the related dependencies that I'm using:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10</version>
</dependency>
Each one of those gives me a different Error, but they all talk about the same thing... Here's one of these errors:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.time.LocalDateTime` from Object value (