Angelo Immediata
Angelo Immediata

Reputation: 6954

Springboot HAPI FHIR graalvm native image

I have an application created by using springboot 3.3.0 and HAPI FHIR 7.2.1

When I start it normally, all works pretty good

Now I'm giving a look to graalvm and native images. I can successfully create the native image but when I launch it I get this error (I insert just the most important message):

    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
    at org.springframework.beans.factory.support.RegisteredBean.resolveAutowiredArgument(RegisteredBean.java:253)
    at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveAutowiredArgument(BeanInstanceSupplier.java:341)
    ... 175 more
Caused by: java.lang.IllegalStateException: HAPI-1680: Could not find the HAPI-FHIR structure JAR on the classpath for version R4. Note that as of HAPI-FHIR v0.8, a separate FHIR strcture JAR must be added to your classpath (or project pom.xml if you are using Maven)
    at ca.uhn.fhir.context.FhirContext.<init>(FhirContext.java:194)
    at ca.uhn.fhir.context.FhirContext.<init>(FhirContext.java:183)
    at ca.uhn.fhir.context.FhirContext.forR4(FhirContext.java:1267)
    at it.olegna.commons.config.FhirConfiguration.fhirContext(FhirConfiguration.java:28)
    at it.olegna.commons.config.FhirConfiguration$$SpringCGLIB$$0.CGLIB$fhirContext$6(<generated>)
    at it.olegna.commons.config.FhirConfiguration$$SpringCGLIB$$FastClass$$1.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:339)
    at it.olegna.commons.config.FhirConfiguration$$SpringCGLIB$$0.fhirContext(<generated>)
    at it.olegna.commons.config.FhirConfiguration__BeanDefinitions.lambda$getFhirContextInstanceSupplier$0(FhirConfiguration__BeanDefinitions.java:35)

I'm struggling on this issue and I can't move on. Does anybody have any tip?

Thank you

Upvotes: 1

Views: 158

Answers (1)

dds
dds

Reputation: 23

Try including hapi-fhir-structures dependency to your project.

<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>hapi-fhir-structures-r4</artifactId>
    <version>7.2.1</version>
</dependency>

Upvotes: 0

Related Questions