Deploying HAPI-FHIR-JPAServer to AWS: App Startup Failure on Indexing Failure

265 views
Skip to first unread message

Ryck Birch

unread,
May 1, 2023, 4:40:24 PM5/1/23
to HAPI FHIR
I have the JPA server being configured with Spring Profiles to specify application profiles. All good so far. 

I have a backing Postgres DB in the AWS cloud that I can point to for a data source and locally, everything works fine. I have hibernate search setting as true. The application starts up without a hitch given the right profile configuration to use.

Locally, I can run the docker image with ZERO issues. However, the MOMENT I try to load the image created from the same docker file, in my AWS service, I get errors that the lucene related TermContent and ResourceTable indices can't be initialized and the app fails to launch.

I have tried every combination of opening up the /app/target directory for open access and still nothing.

ANYONE ABLE TO HELP OR GIVE ME SOMETHING TO LOOK FURHTER INTO THIS WITH??? Am stumped.

Many thanks,
Ryck Birch

Here is the essential error stack:

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: HAPI_PU] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.search.util.common.SearchException: HSEARCH000520: Hibernate Search encountered failures during bootstrap. Failures:

    index 'TermConcept':
        failures:
          - HSEARCH600154: Unable to start index: HSEARCH600015: Unable to initialize index directory: /app/target
            Context: index 'TermConcept'
    index 'ResourceTable':
        failures:
          - HSEARCH600154: Unable to start index: HSEARCH600015: Unable to initialize index directory: /app/target
            Context: index 'ResourceTable'
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
        ... 103 common frames omitted

James Agnew

unread,
May 1, 2023, 6:16:17 PM5/1/23
to Ryck Birch, HAPI FHIR
FWIW: I spoke with someone recently who had a similar issue and it turned out to be that Tomcat was sandboxed to only being allowed to write to a few directories, so you need to configure Lucene/Hibernate Search to only write within one of those. See this readme: https://salsa.debian.org/java-team/tomcat9/blob/master/debian/README.Debian

Unfortunately I don't know anything more about this because I don't really use this configuration, but this fixed it for him.

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/debc45e1-801f-402a-8617-4d572d678ab5n%40googlegroups.com.

Ryck Birch

unread,
May 5, 2023, 3:22:56 PM5/5/23
to HAPI FHIR
James:

So the issue turned out to be a problem with the distroless image in the cloud. For some reason, where locally there was zero problem, in the AWS cloud instance, the user could not create the lucenefiles directories under the target directory. The long and the short of it was that I moved the creation of those directories up to the top of the docker file where the maven work with the .app directory was occurring and "manually" created them there. Once that was done the docker COPY with --chown: etc. copied all the now enriched directory structure and things started up perfectly.

Go figure... :-) 

Thanks a million for your reply. Although it didn't quite hit the issue it started the train of thought that did. I am in your debt, my friend!

Warmest regards,

Ryck

Reply all
Reply to author
Forward
0 new messages