HAPI FHIR Starter - Error when restarting server after adding implementation guide

717 views
Skip to first unread message

Chris Hirs

unread,
Feb 16, 2023, 2:29:59 AM2/16/23
to HAPI FHIR
Hi,

I'm playing with implementation guides on the HAPI FHIR Starter server. I did not change anything in the server files but these lines in application.yaml :

hapi:
  fhir:
  (...)
  implementationguides:
      ch-core:
        name: ch.fhir.ig.ch-core
        version: 3.0.0
  (...)
  enable_repository_validating_interceptor: true

If I start the server the first time, there is no problem. It downloads resources and I can reach it on localhost:8080.

If I stop and restart the server, I get this error:

java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Unable to start web server;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with
name 'hapiServletRegistration' defined in ca.uhn.fhir.jpa.starter.Application: Unsatisfied dependency expressed
through method 'hapiServletRegistration' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'restfulServer' defined in class path resource [ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.class]:
Unsatisfied dependency expressed through method 'restfulServer' parameter 24; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'repositoryValidatingInterceptor' defined in class path resource [ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [ca.uhn.fhir.jpa.interceptor.validation.RepositoryValidatingInterceptor]:
Factory method 'repositoryValidatingInterceptor' threw exception; nested exception is java.lang.NullPointerException:
Cannot invoke "java.lang.Integer.intValue()" because the return value of "ca.uhn.fhir.rest.api.server.IBundleProvider.size()" is null
    at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart (ServletContainerInitializersStarter.java:69)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:73)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext (ServletContextHandler.java:356)
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp (WebAppContext.java:1449)
    at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp (JettyWebAppContext.java:328)
    at org.eclipse.jetty.webapp.WebAppContext.startContext (WebAppContext.java:1414)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart (ContextHandler.java:916)
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart (ServletContextHandler.java:288)
    at org.eclipse.jetty.webapp.WebAppContext.doStart (WebAppContext.java:524)
    at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart (JettyWebAppContext.java:397)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:73)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:117)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:97)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:73)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:117)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:97)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:73)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:169)
    at org.eclipse.jetty.server.Server.start (Server.java:423)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:110)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:97)
    at org.eclipse.jetty.server.Server.doStart (Server.java:387)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:73)
    at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty (AbstractJettyMojo.java:449)
    at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute (AbstractJettyMojo.java:310)
    at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute (JettyRunMojo.java:150)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:298)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

It's reproducible: if I get the lastest version of the HAPI FHIR starter server and modify the application.yaml, I get this error after restarting.

Am I missing something? Could it be the implementation guide that could somehow break everyting?

Thank you

Chris Hirs

unread,
Feb 20, 2023, 5:44:52 AM2/20/23
to HAPI FHIR
Updating this thread:

The error seemed to come from the code in the buildUsingStoredStructureDefinitions method in RepositoryValidationInterceptorFactoryR4.java file (line 51).

I just added a condition before to check if results.size() is null... I'm not really sure why the results are null tho, but at least I can restart the server now!

pa.f....@gmail.com

unread,
Feb 26, 2023, 9:51:04 AM2/26/23
to HAPI FHIR
Would you mind adding a issue to the jpaStarter Project on that one?

Chris Hirs

unread,
Mar 13, 2023, 4:13:55 AM3/13/23
to HAPI FHIR

Gregor Munro

unread,
May 8, 2023, 4:24:22 PM5/8/23
to HAPI FHIR
Hi Chris, did you get anywhere with this?
I'm experiencing the same problem (with the https://hub.docker.com/r/hapiproject/hapi version). It looks to my untrained Java eye, as if the routine is making a call to a deprecated bit of code.

I tried your solution and then creating my own version of that docker image but its proving difficult. 

James Agnew

unread,
May 8, 2023, 10:32:53 PM5/8/23
to Gregor Munro, HAPI FHIR
For what it's worth, I've commented on the github issue with a suggested fix. If someone wanted to test and submit a PR against the starter project that would be great.

Cheers,
James

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/1d12f7bd-8904-43c5-b8b5-2e2c06dcf63bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages