Stream: IG creation
Topic: JsonPrimitive cannot be cast to JsonObject error
Rob Hausam (Oct 15 2018 at 11:51):
Any suggestions for what the specific issue is or how best to debug this? It was working until the latest IGPublisher changes (not sure what particular commit).
Initialization complete (29.0645sec) Load Content (29.0645sec) Publishing Content Failed: Unable to determine type for /Users/rhausam/git-repo/fhir-ips/examples/IPS-bundle-01: com.google.gson.JsonPrimitive cannot be cast to com.google.gson.JsonObject (30.0338sec) (30.0338sec) Use -? to get command line help (30.0338sec) (30.0338sec) Stack Dump (for debugging): (30.0338sec) java.lang.Exception: Unable to determine type for /Users/rhausam/git-repo/fhir-ips/examples/IPS-bundle-01: com.google.gson.JsonPrimitive cannot be cast to com.google.gson.JsonObject at org.hl7.fhir.igtools.publisher.Publisher.loadAsElementModel(Publisher.java:2395) at org.hl7.fhir.igtools.publisher.Publisher.load(Publisher.java:1779) at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:583) at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:527) at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:4926) Caused by: java.lang.ClassCastException: com.google.gson.JsonPrimitive cannot be cast to com.google.gson.JsonObject at com.google.gson.JsonObject.getAsJsonObject(JsonObject.java:182) at org.hl7.fhir.r4.formats.JsonParser.parseMedicationStatementProperties(JsonParser.java:16553) at org.hl7.fhir.r4.formats.JsonParser.parseMedicationStatement(JsonParser.java:16528) at org.hl7.fhir.r4.formats.JsonParser.parseResource(JsonParser.java:27888) at org.hl7.fhir.r4.formats.JsonParser.parseBundleBundleEntryComponentProperties(JsonParser.java:3255) at org.hl7.fhir.r4.formats.JsonParser.parseBundleBundleEntryComponent(JsonParser.java:3238) at org.hl7.fhir.r4.formats.JsonParser.parseBundleProperties(JsonParser.java:3211) at org.hl7.fhir.r4.formats.JsonParser.parseBundle(JsonParser.java:3182) at org.hl7.fhir.r4.formats.JsonParser.parseResource(JsonParser.java:27750) at org.hl7.fhir.r4.formats.JsonParserBase.parse(JsonParserBase.java:92) at org.hl7.fhir.r4.formats.ParserBase.parse(ParserBase.java:58) at org.hl7.fhir.r4.elementmodel.ObjectConverter.convert(ObjectConverter.java:90) at org.hl7.fhir.igtools.publisher.Publisher.loadAsElementModel(Publisher.java:2388) ... 4 more Exception in thread "main" java.lang.NullPointerException at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:4936)
The bundle has 1007 lines, and the error doesn't provide a way to know where in the bundle it's failing.
Rob Hausam (Oct 15 2018 at 12:02):
The error seems to be in MedicationStatement, so that will narrow it down a bit.
Lloyd McKenzie (Oct 15 2018 at 16:51):
It's a synchronization issue. Status got changed to CodeableConcept, then back to code. It may be that @Grahame Grieve needs to push an update to the generation code. I've wiped my cache for current and it didn't help.
Grahame Grieve (Oct 16 2018 at 19:32):
should be fixed
Last updated: Apr 12 2022 at 19:14 UTC