Search code examples
hl7-fhirpublisher

FHIR publisher fails on a java NullPointerException


I am trying to build our IG for the first time using the publishler.jar but am getting a NullPointerException. I understand that there is some problem with it not managing to find some code in a CodeSystem but I can't figure it out. One clear problem that you'll see when I paste the output is that, for some reason it is working with r5 but we need r4 (4.0.1) and I have a hunch that this is leading to the problem because in r5 we do seem to have some issue with CodeSystems we still haven't figured out. Maybe someone can figure out what I'm doing wrong.

I actually tried 2 different approaches. the first:

java -jar publisher.jar -ig "c:\FHIR\outburn\fsh-generated\resources\ImplementationGuide-outburn.json" output:

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
FHIR IG Publisher Version 1.1.104 (Git# 036db5f8f83b). Built 2022-02-16T06:43:23.823Z (13 hours old)
Detected Java version: 1.8.0_275 from C:\Program Files\AdoptOpenJDK\jdk-8.0.275.1-hotspot\jre on Windows 10/amd64 (64bit). 1796MB available
dir = C:\FHIR\outburn\input-cache, path = C:\Python39\Scripts\;C:\Python39\;C:\Program Files\AdoptOpenJDK\jdk-8.0.275.1-hotspot\bin;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 @ Wednesday, February 16, 2022 9:53:20 PM IST (2022-02-16T21:53:20+02:00)

API keys loaded from C:\Users\amosr\fhir-api-keys.ini                            (00:00.0010)
Package Cache: C:\Users\amosr\.fhir\packages                                     (00:00.0014)
Load Configuration from c:\FHIR\outburn\fsh-generated\resources\ImplementationGuide-outburn.json (00:00.0030)
Root directory: C:\FHIR\outburn\fsh-generated\resources                          (00:00.0060)
Publishing Content Failed: null                                                  (00:00.0064)
                                                                                 (00:00.0065)
Use -? to get command line help                                                  (00:00.0070)
                                                                                 (00:00.0072)
Stack Dump (for debugging):                                                      (00:00.0073)
java.lang.NullPointerException
        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)

the second attempt was to use the _geounce.bat (which looks like this(link))

when run correctly it starts off with running SUSHI, which takes FHIR Shorthand files and turns them to JSON. That part's fine so I am removing that part of the output:
C:\FHIR\outburn>_genonce.bat -ig "c:\FHIR\outburn\fsh-generated\resources\ImplementationGuide-outburn.json"
Checking internet connection...
Reply from 104.196.166.17: bytes=32 time=161ms TTL=115
We're online
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
FHIR IG Publisher Version 1.1.104 (Git# 036db5f8f83b). Built 2022-02-16T06:43:23.823Z (12 hours old)
Detected Java version: 1.8.0_275 from C:\Program Files\AdoptOpenJDK\jdk-8.0.275.1-hotspot\jre on Windows 10/amd64 (64bit). 1796MB available
dir = C:\FHIR\outburn, path = C:\Python39\Scripts\;C:\Python39\;C:\Program Files\AdoptOpenJDK\jdk-8.0.275.1-hotspot\bin;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 . -ig c:\FHIR\outburn\fsh-generated\resources\ImplementationGuide-outburn.json
Start Clock @ Wednesday, February 16, 2022 8:46:45 PM IST (2022-02-16T20:46:45+02:00)

API keys loaded from C:\Users\amosr\fhir-api-keys.ini                            (00:00.0009)
Package Cache: C:\Users\amosr\.fhir\packages                                     (00:00.0014)
Run Sushi on C:\FHIR\outburn                                                     (00:00.0016)
--this was SUSHI output --
Load Template from hl7.base.template                                             (00:30.0410)
2022-02-16 20:47:24.317 [main] INFO  o.h.f.u.n.FilesystemPackageCacheManager [FilesystemPackageCacheManager.java:232] Failed to determine latest version of package hl7.base.template from server: http://packages.fhir.org
 Load Template from fhir.base.template#0.2.2                                     (00:40.0309)

onLoad.findSpreadsheets:

onLoad.updateIg:
     [xslt] Processing C:\FHIR\outburn\template\onLoad-ig-working.xml to C:\FHIR\outburn\template\onLoad-ig-updated.xml
     [xslt] Loading stylesheet C:\FHIR\outburn\template\scripts\onLoad.xslt

onLoad.extend:

onLoad:
Root directory: C:\FHIR\outburn                                                  (00:45.0121)
Core Package hl7.fhir.r4.core#4.0.1
Terminology Cache is at C:\FHIR\outburn\input-cache\txcache. 1 files in cache    (00:50.0633)
Connect to Terminology Server at http://tx.fhir.org                              (00:50.0637)
Load Package hl7.fhir.pubpack#0.0.9
Load Package hl7.fhir.xver-extensions#0.0.8
Load Package hl7.terminology.r4#3.0.0
Initialization complete                                                          (00:56.0996)
Fetch http://fhir.outburn.co.il/package-list.json for version check              (00:56.0999)
Load Content                                                                     (00:58.0044)
loadPrePages from FetchedFile[C:\FHIR\outburn\fsh-generated\includes] as C:\FHIR\outburn\fsh-generated\includes
Processing Conformance Resources                                                 (00:59.0527)
Generating Snapshots                                                             (01:00.0197)
Making device-mappings.html#udi relative to 'http://hl7.org/fhir/R4/'
Making event.html relative to 'http://hl7.org/fhir/R4/'
Making servicerequest-example-di.html relative to 'http://hl7.org/fhir/R4/'
Making servicerequest-example-di.html relative to 'http://hl7.org/fhir/R4/'
Generating Narratives                                                            (01:01.0699)
Publishing Content Failed: null                                                  (01:02.0700)
                                                                                 (01:02.0701)
Use -? to get command line help                                                  (01:02.0704)
                                                                                 (01:02.0709)
Stack Dump (for debugging):                                                      (01:02.0710)
java.lang.NullPointerException
        at org.hl7.fhir.r5.terminologies.CodeSystemUtilities.hasCode(CodeSystemUtilities.java:441)
        at org.hl7.fhir.r5.terminologies.CodeSystemUtilities.hasCode(CodeSystemUtilities.java:433)
        at org.hl7.fhir.r5.renderers.CodeSystemRenderer.showPropertyInTable(CodeSystemRenderer.java:248)
        at org.hl7.fhir.r5.renderers.CodeSystemRenderer.generateCodeSystemContent(CodeSystemRenderer.java:153)
        at org.hl7.fhir.r5.renderers.CodeSystemRenderer.render(CodeSystemRenderer.java:60)
        at org.hl7.fhir.r5.renderers.CodeSystemRenderer.render(CodeSystemRenderer.java:43)
        at org.hl7.fhir.r5.renderers.ResourceRenderer.render(ResourceRenderer.java:77)
        at org.hl7.fhir.igtools.publisher.Publisher.generateNarratives(Publisher.java:1806)
        at org.hl7.fhir.igtools.publisher.Publisher.loadConformance(Publisher.java:4671)
        at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:1005)
        at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:856)
        at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:10005)
Press any key to continue . . .

I really hope someone can help me because I am starting to lose it :) Hope the post wasn't too long. If it is, let me know and I'll take the outputs out to a snippet site.


Solution

  • that’s a bug in the IG publisher for sure. Will be fixed next release. but the cause is because you have a URL for the property that is simply a URL. That might be valid and what you want, or not.

    Explanation:

    enter image description here

    The property definition has a uri that formally identifies the property. The IGPublisher was expecting that to be in the format {code-system-uri}#{code} but that format isn't required.