Uploaded image for project: 'FHIR Module v2'
  1. FHIR Module v2
  2. FM2-120

NullPointerException when loading FHIR module in RefApp 2.9.0 Docker

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Undetermined
    • Development:

      Description

      When deploying this module into the RefApp 2.9.0 Docker image, the following error is generated when trying to start the module: https://pastebin.com/5UwmTtZF.

      The root cause is this:

      Caused by: java.lang.NullPointerException
      	at org.openmrs.module.fhir2.web.servlet.FhirRestServlet.initialize(FhirRestServlet.java:54)
      	at ca.uhn.fhir.rest.server.RestfulServer.init(RestfulServer.java:1203)
      	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      	at org.openmrs.module.web.WebModuleUtil.loadServlets(WebModuleUtil.java:474)

      While NullPointerExceptions are usually straight-forward, this one gets a little weird. First, this does not happen when deploying to a RefApp 2.9.0 server that was created using openmrs-sdk (tested on version 3.13.4).

      The FHIR module installs a servlet the FhirRestServlet which is a subclass of the HAPI FHIR RestfulServer, which serves as the main entry point for all the FHIR requests. This allows us to take advantage of the extensive functionality provided by the HAPI Plain Server and our subclass is basically there to configure the the RestfulServer as shown in this example.

      The properties we configure we inject using Spring. This is important to ensure that the modules implementation remains overrideable, since the best way to map data to FHIR resources can be heavily implementation-dependent. Modules that rely on the FHIR2 module are able to add new IResourceProvider instances or override our translator layer using Spring configuration. To this end, we use this line to inject the properties from the Spring configuration into our instance:

      SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, getServletContext());
      

      This seems to work in SDK-deployed servers, but not in the RefApp docker image nor (as has been separately reported) in the RefApp 2.6 standalone version. So we end up with a NPE at the first point we try to use a Spring-injected property.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                ibacher Ian Bacher
                Reporter:
                corneliouzbett Bett Kipchumba
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: