FHIR Chat · publisher nullPointerException · implementers

Stream: implementers

Topic: publisher nullPointerException


view this post on Zulip Kippi Bordowitz (Feb 21 2022 at 13:20):

Hi all. We are trying to use the publisher.jar and running up a brick wall. I tried using the _genonce.bat and also tried using the direct approach of doing it myself with:
java -jar input-cache/publisher.jar -ig "c:\FHIR\outburn\fsh-generated\resources\ImplementationGuide-outburn.json"

in both cases I get the following output with literally no information I can actually glean as to what the problem actually is:

FHIR IG Publisher Version 1.1.106 (Git# 390af812658f). Built 2022-02-20T20:44:29.505Z (16 hours old)
Detected Java version: 17.0.2 from C:\Program Files\Java\jdk-17.0.2 on Windows 10/amd64 (64bit). 2020MB available
dir = C:\FHIR\outburn, path = C:\Program Files\Common Files\Oracle\Java\javapath;C:\Python39\Scripts\;C:\Python39\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Calibre2\;C:\hapi-fhir-cli;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Ruby27-x64\bin;C:\Users\amosr\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\amosr\AppData\Local\Programs\Python\Python38-32\;C:\Users\amosr\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\JetBrains\PyCharm 2019.3.4\bin;;C:\Users\amosr\AppData\Roaming\npm
Parameters: -ig c:\FHIR\outburn\fsh-generated\resources\ImplementationGuide-outburn.json
Start Clock @ Monday, February 21, 2022 at 3:18:21 PM Israel Standard Time (2022-02-21T15:18:21+02:00)

API keys loaded from C:\Users\amosr\fhir-api-keys.ini                            (00:00.0008)
Package Cache: C:\Users\amosr\.fhir\packages                                     (00:00.0015)
Load Configuration from c:\FHIR\outburn\fsh-generated\resources\ImplementationGuide-outburn.json (00:00.0035)
Root directory: C:\FHIR\outburn\fsh-generated\resources                          (00:00.0074)
Publishing Content Failed: Cannot invoke "com.google.gson.JsonObject.has(String)" because "paths" is null (00:00.0077)
                                                                                 (00:00.0079)
Use -? to get command line help                                                  (00:00.0080)
                                                                                 (00:00.0081)
Stack Dump (for debugging):                                                      (00:00.0082)
java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonObject.has(String)" because "paths" is null
        at org.hl7.fhir.igtools.publisher.Publisher.initializeFromJson(Publisher.java:2920)
        at org.hl7.fhir.igtools.publisher.Publisher.initialize(Publisher.java:2162)
        at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:850)
        at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:10005)

If anyone can tell me what I'm doing wrong, it would be of great help!

BTW - I tried running the publisher by double clicking in it and nothing happens. I know that it doesn\t work with open-jdk so I installed a new version of java. Still nothing :(

view this post on Zulip Grahame Grieve (Feb 21 2022 at 23:06):

I don't know why double clicking doesn't work. It should. but it's not a feature that works well, or any uses. I'll look at that at some stage

view this post on Zulip Grahame Grieve (Feb 21 2022 at 23:06):

for the problem: it looks like an issue with the template set up. Can I reproduce this?

view this post on Zulip Grahame Grieve (Feb 21 2022 at 23:06):

btw: #IG creation is a better place for this question

view this post on Zulip Kippi Bordowitz (Feb 22 2022 at 16:01):

Not sure I understand the question. do you want me to send you the files? Also, i can no longer move this. Should I delete and repost in the proper place?

view this post on Zulip Jose Costa Teixeira (Feb 22 2022 at 19:12):

@Kippi Bordowitz the "usual" way of providing a reproducible error is pointing to an online repository such as github

view this post on Zulip Kippi Bordowitz (Feb 23 2022 at 14:36):

@Grahame Grieve
I created a repository in order for you to be able to try and reproduce the bug.
please follow this link. I removed the publisher.jar file

BTW there is another problem:
as we use FSH for our project, the sushi-config.yaml file's "version" field stores not the fihrVrsion, rather the version number of the project. There is a saparate field for fhirVersion. For some reason, the igpublisher takes the "version" field in the implementationGuide.json file as the FHIR version so I have to change it manually. That seems like a bug to me. Is there some place I should report it?

view this post on Zulip Grahame Grieve (Feb 23 2022 at 23:47):

I get

onGenerate.jira.setup:
     [xslt] Processing /Users/grahamegrieve/temp/igs/outburn_test/outburn/template/onGenerate-ig-updated.xml to /Users/grahamegrieve/temp/igs/outburn_test/outburn/template/properties.txt
     [xslt] Loading stylesheet /Users/grahamegrieve/temp/igs/outburn_test/outburn/template/scripts/onGenerate.genProperties.xslt
When using the HL7 template, the IG id must start with "hl7." - found outburn
     [xslt] /Users/grahamegrieve/temp/igs/outburn_test/outburn/template/scripts/onGenerate.genProperties.xslt:35:7: Fatal Error! Processing terminated by xsl:message at line 35 in onGenerate.genProperties.xslt
     [xslt] Failed to process /Users/grahamegrieve/temp/igs/outburn_test/outburn/template/onGenerate-ig-updated.xml
Publishing Content Failed: Fatal error during transformation using /Users/grahamegrieve/temp/igs/outburn_test/outburn/template/scripts/onGenerate.genProperties.xslt: Processing terminated by xsl:message at line 35 in onGenerate.genProperties.xslt; SystemID: file:/Users/grahamegrieve/temp/igs/outburn_test/outburn/template/scripts/onGenerate.genProperties.xslt; Line#: 35; Column#: 7 (00:33.0106)
                                                                                 (00:33.0108)
This error was created by the template                                           (00:33.0108)

view this post on Zulip Grahame Grieve (Feb 23 2022 at 23:47):

that doesn't seem like what you were expecting

view this post on Zulip Kippi Bordowitz (Feb 27 2022 at 15:40):

Thank you, @Grahame Grieve for trying to reproduce it.
Correct. It's a different error... Very perplexing but I am no Java expert...
So... How do we move forward? Also, did you note the second thing I wrote re the version?

view this post on Zulip Jose Costa Teixeira (Feb 27 2022 at 20:06):

@Kippi Bordowitz your ig.ini says you want to use the HL7 IG template, but that is reserved for IGs that are published by HL7

view this post on Zulip Jose Costa Teixeira (Feb 27 2022 at 20:08):

as for the version, I don't see the issue

view this post on Zulip Jose Costa Teixeira (Feb 27 2022 at 20:09):

your generated ig json says

...
  "version": "0.3.0",
...
 "fhirVersion": [
    "4.0.1"
  ],

view this post on Zulip Jose Costa Teixeira (Feb 27 2022 at 20:09):

as it should

view this post on Zulip Jose Costa Teixeira (Feb 27 2022 at 20:10):

and the publisher takes it correctly:
image.png

view this post on Zulip Jose Costa Teixeira (Feb 27 2022 at 20:10):

(deleted)

view this post on Zulip Kippi Bordowitz (Feb 28 2022 at 12:23):

@Jose Costa Teixeira
here is what happen if I don't change the "version" in the implementationGuide-outburn.json manually:

Stack Dump (for debugging):                                                      (00:00.0063)
java.lang.Exception: Error: the IG declares that is based on version 0.3.0 but this IG publisher only supports publishing the following versions: 1.0.2, 1.4.0, 3.0.2, 4.0.1, 4.1.0, 4.3.0, 5.0, 4.6.0
        at org.hl7.fhir.igtools.publisher.Publisher.initializeFromJson(Publisher.java:2865)
        at org.hl7.fhir.igtools.publisher.Publisher.initialize(Publisher.java:2162)
        at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:850)
        at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:10005)

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 12:27):

if you are using sushi, you should not ever need to change the implementationguide json

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 12:30):

i downloaded your IG and it builds fine

view this post on Zulip Kippi Bordowitz (Feb 28 2022 at 13:53):

@Jose Costa Teixeira I really wish we had the same experience...
I cannot explain it. But unless I change it by hand, it fails, as I have presented here.
But that's minimal compared with the major problem - I have changed the template but it still fails.
I am at my wits end here.

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 13:55):

ok perhaps best is to put this in a more orthodox form

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 13:56):

can you move in your the content to the root of the repo, instead of inside the folder?

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 13:56):

also, try deleting the input-cache folder and the output folder

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 13:57):

and the fsh-generated

view this post on Zulip John Moehrke (Feb 28 2022 at 14:02):

have you updated sushi ?

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 14:07):

good point. the version thing is not how sushi should behave, so you may have an old bug

view this post on Zulip Kippi Bordowitz (Feb 28 2022 at 14:35):

I'm not sure I understood all the previous remark. Regarding updating Sushi, I will try that. But that will only take care of the versioning problem, not the main one I started this thread about.
The problem with deleting the input-cache folder is that the _genounce.bat expects to find publisher.jar there. Not that i am having any luck with using that method either...
"can you move in your the content to the root of the repo, instead of inside the folder?" - Sorry - this is what I couldn't understand.

view this post on Zulip John Moehrke (Feb 28 2022 at 14:51):

you should keep a copy of _updatePublisher.bat... and use that to get the updated publisher, and get the updated bat/sh files.

view this post on Zulip John Moehrke (Feb 28 2022 at 14:52):

I have been keeping only _updatePublsiher.bat in my github repo; and adding a .gitignore for the other scripts.

view this post on Zulip John Moehrke (Feb 28 2022 at 14:52):

this way I can delete everything not maintained in git. run _updatePublisher, make sure my sushi is fresh (old sushi, yuck). then build

view this post on Zulip John Moehrke (Feb 28 2022 at 14:53):

given that your project built fine for Jose; I suspect it is old sushi or build.

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 14:53):

@Kippi Bordowitz your folder should look like this
https://github.com/costateixeira/outburn_test

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 14:54):

in there, you can run the _updatepublisher - will download the publisher if you don't have it in the parent folder.
then you run _genonce

view this post on Zulip Kippi Bordowitz (Feb 28 2022 at 15:13):

I updated sushi and now I get new errors in the sushi run that weren't there in the 1.3.2 version. great haha.
I'm going to have to figure those out before I move forward. Just read the release notes for version and couldn't see any breaking change that should have led to this. Sorry for veering completely off topic but if you have any ideas, I'd be grateful.
Here's is the output:

info  Converting FSH to FHIR resources...
error Cannot read property 'element' of undefined
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 45 - 50
error No element found at path extension[parentName] for CardRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 45 - 50
error No element found at path extension[birthPlace] for CardRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 45 - 50
error No element found at path extension[immigration] for CardRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 45 - 50
error No element found at path extension[birthSex] for CardRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 45 - 50
error No element found at path extension[parentName] for CaretValueRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 54
error No element found at path extension[parentName] for CaretValueRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 55
error No element found at path extension[parentName] for CaretValueRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 56
error No element found at path extension[birthPlace] for CaretValueRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 57
error No element found at path extension[birthPlace] for CaretValueRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 58
error No element found at path extension[immigration] for CaretValueRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 59
error No element found at path extension[immigration] for CaretValueRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 60
error No element found at path extension[birthSex] for CaretValueRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 61
error No element found at path extension[birthSex] for CaretValueRule in HadassahPatient, skipping rule
  File: C:\FHIR\outburn\input\fsh\Patient-Hadassah.fsh
  Line: 62

the lines of code pertaining to the error are:

* extension contains
    $ext-il-hmo named hmo 0..1 and
    $ext-parent-name named parentName 0..* and
    $ext-birth-place named birthPlace 0..1 and
    $ext-patient-immigration named immigration 0..* and
    $us-core-birth-sex named birthSex 0..1
* extension[hmo] ^short = "Extension: Israel Core HMO (קופת חולים)"
* extension[hmo] ^definition = "A code classifying the person's Israeli HMO"
* extension[hmo] ^mustSupport = true
* extension[parentName] ^short = "Extension: The name of the parent"
* extension[parentName] ^definition = "Specifies the entire parent name as it should be displayed e.g. on an application UI."
* extension[parentName] ^mustSupport = true
* extension[birthPlace] ^short = "Extension: Place of Birth for patient"
* extension[birthPlace] ^definition = "The registered place of birth of the patient. A sytem may use the address.text if they don't store the birthPlace address in discrete elements"
* extension[immigration] ^short = "Extension: Patient Immigration"
* extension[immigration] ^definition = "Extension: Immigration information for patien - for the purpose of this extension - immigration is an international movement of a person to a destination country in order to settle as permanent resident"
* extension[birthSex] ^short = "Extension: US Core Birth Sex Extension"
* extension[birthSex] ^definition = "A code classifying the person’s sex assigned at birth as specified by the Office of the National Coordinator for Health IT (ONC). This extension aligns with the C-CDA Birth Sex Observation (LOINC 76689-9)."

If you have no idea I'll post it in the Sushi section, but as I made the change due to this very conversation I figured you might have an idea.

view this post on Zulip Jose Costa Teixeira (Feb 28 2022 at 15:16):

well, I can build your IG absolutely fine as is (i haven't updated sushi in a few weeks, but it is working ok)

view this post on Zulip John Moehrke (Feb 28 2022 at 15:23):

it sushi builds, but I do get a build error much later during xslt transforming.

view this post on Zulip John Moehrke (Feb 28 2022 at 15:23):

makes me wonder if your build environment is got something out-of-date... java, node, ?

view this post on Zulip Kippi Bordowitz (Feb 28 2022 at 15:29):

well... this is all extremely frustrating :(

view this post on Zulip Kippi Bordowitz (Feb 28 2022 at 16:21):

well, I rolled back version by version of sushi until I arrived at 2.2.1 which no longer returned the sushi errors. So that's one problem off the list. Will post a bug report. This still has no effect on the previous problems. Next I updated Java jdk to latest stable and also node. Next, I deleted all the folders @Jose Costa Teixeira suggested, ran _updatepublisher.bat.
Finally ran _genounce.bat and it looked like it was finally going to work but I got the following:

onGenerate:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.Arrays.copyOf(Arrays.java:3537)
        at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:228)
        at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:582)
        at java.base/java.lang.StringBuilder.append(StringBuilder.java:179)
        at org.hl7.fhir.igtools.renderers.XmlXHtmlRenderer.writeAttributeSet(XmlXHtmlRenderer.java:188)
        at org.hl7.fhir.igtools.renderers.XmlXHtmlRenderer.writeAttributes(XmlXHtmlRenderer.java:150)
        at org.hl7.fhir.igtools.renderers.XmlXHtmlRenderer.enter(XmlXHtmlRenderer.java:475)
        at org.hl7.fhir.igtools.renderers.XmlXHtmlRenderer.enter(XmlXHtmlRenderer.java:428)
        at org.hl7.fhir.igtools.renderers.XmlXHtmlRenderer.element(XmlXHtmlRenderer.java:602)
        at org.hl7.fhir.igtools.renderers.XmlXHtmlRenderer.element(XmlXHtmlRenderer.java:626)
        at org.hl7.fhir.r5.elementmodel.XmlParser.composeElement(XmlParser.java:700)
        at org.hl7.fhir.r5.elementmodel.XmlParser.composeElement(XmlParser.java:728)
        at org.hl7.fhir.r5.elementmodel.XmlParser.composeElement(XmlParser.java:728)
        at org.hl7.fhir.r5.elementmodel.XmlParser.composeElement(XmlParser.java:728)
        at org.hl7.fhir.r5.elementmodel.XmlParser.composeElement(XmlParser.java:728)
        at org.hl7.fhir.r5.elementmodel.XmlParser.compose(XmlParser.java:647)
        at org.hl7.fhir.igtools.publisher.Publisher.saveDirectResourceOutputs(Publisher.java:8668)
        at org.hl7.fhir.igtools.publisher.Publisher.generateHtmlOutputs(Publisher.java:8044)
        at org.hl7.fhir.igtools.publisher.Publisher.generate(Publisher.java:5854)
        at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:1018)
        at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:856)
        at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:10005)

I was surprised to find an "OutOfMemory" error. So I restarted my computer and ran it with nothing else open. Still no dice. I am out of ideas.
@Grahame Grieve any ideas?

view this post on Zulip Grahame Grieve (Feb 28 2022 at 19:20):

the log will say how much memory is available at the start of the run. But Java doesn't use as much memory as is available - you have to tell if how much to make available to the IGPublisher

view this post on Zulip Kippi Bordowitz (Mar 01 2022 at 12:34):

@Grahame Grieve
OK. So... how do I do that? I can't find this information by myself anywhere.

view this post on Zulip Grahame Grieve (Mar 01 2022 at 12:34):

it'll be in the first few lines of the log

view this post on Zulip Kippi Bordowitz (Mar 01 2022 at 13:26):

I am asking how I can add more memory to java. I can't find a solution that works. Please... help. I have been trying to get this thing to work for so long... Also I don't see anything on the subject in the log but maybe I'm not understanding where you actually mean. Please - I understand your need for brevity, you probably answer dozens of messages a day. But I need a bit more information and then I'll be off your back :)
Much appreciated!

**edit- I figured it out


Last updated: Apr 12 2022 at 19:14 UTC