Error in JSON serialization of Patient object in Spring Boot application

1,208 views
Skip to first unread message

Siddhartha Gupta

unread,
Apr 5, 2018, 12:05:22 AM4/5/18
to HAPI FHIR

Hi,

Whenever I am trying to use HAPI FHIR structures in my spring boot application, while getting the response I getting the following error:

{
    "timestamp": 1522900137233,
    "status": 500,
    "error": "Internal Server Error",
    "exception": "org.springframework.http.converter.HttpMessageNotWritableException",
    "message": "Could not write JSON: InstantType contains null value; nested exception is com.fasterxml.jackson.databind.JsonMappingException: InstantType contains null value (through reference chain: org.hl7.fhir.dstu3.model.Patient[\"meta\"]->org.hl7.fhir.dstu3.model.Meta[\"lastUpdatedElement\"]->org.hl7.fhir.dstu3.model.InstantType[\"today\"])",
    "path": "/hello1"
}

There seems to be a HttpMessageNotWritableException and JsonMappingException. It is unable to serialize and parse the json. 

Is there any workaround on this ? I am NOT useing the HAPI FHIR server. It is a spring boot app.

Thanks,
Siddhartha

James Agnew

unread,
Apr 5, 2018, 6:33:25 AM4/5/18
to Siddhartha Gupta, HAPI FHIR
I would recommend using the HAPI FHIR server for this, as Spring Boot does not natively understand how to parse and serialize FHIR. You can find an example of how to do this here: https://github.com/jamesagnew/hapi-fhir/tree/master/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey

Cheers,
Jams

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/4d1d8195-58ae-48a2-9596-d9f15699f257%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages