Stream: implementers
Topic: hapi implementation JsonMappingException
Etienne Cantineau (Oct 09 2019 at 13:43):
Hello all,
I'm having trouble implementing hapi resource models. If I use any class from "org.hl7.fhir.r4.model", I get an error "com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError)".
here is a small example of code that triggers that error:
*Patient patient = new Patient();
patient.setGender(Enumerations.AdministrativeGender.MALE);
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
try {
System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(patient));
} catch (IOException e) {
e.printStackTrace();
}*
Any idea how to solve that?
Thank you
Lloyd McKenzie (Oct 09 2019 at 15:42):
You might want to raise this on #hapi
Etienne Cantineau (Oct 10 2019 at 06:36):
Thank you, i'm new here and didn't know about that stream. I've found similar question there and the answer!
Last updated: Apr 12 2022 at 19:14 UTC