hapifhir / hapi-fhir-jpaserver-starter

Apache License 2.0
394 stars 1.05k forks source link

Adding an ig with reference to codesystem urn:ietf:bcp:13 fails #636

Closed sebastianhelbig closed 9 months ago

sebastianhelbig commented 9 months ago

I am adding an implementation guide which contains a valueset which uses the codesystem urn:ietf:bcp:13. This will crash hapi on startup. Example value set: https://hl7.org/fhir/valueset-mimetypes.json.html

spring:
  batch:
    job:
      enabled: false
  datasource:
    driverClassName: org.postgresql.Driver
    hikari:
      maximum-pool-size: 10
    max-active: 15
    password: null
    url: 'jdbc:postgresql://localhost:5432/fhir'
    username: bfarm
  flyway:
    baselineOnMigrate: true
    check-location: false
    enabled: false
  jpa:
    properties:
      hibernate.dialect: ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect
      hibernate.format_sql: false
      hibernate.search.backend.directory.root: /tmp/bfarm-data/lucene/fhir_test
      hibernate.search.backend.directory.type: local-filesystem
      hibernate.search.backend.lucene_version: lucene_current
      hibernate.search.backend.type: lucene
      hibernate.search.enabled: true
      hibernate.show_sql: false
  main:
    allow-circular-references: true
hapi:
  fhir:
    advanced_lucene_indexing: false
    allow_cascading_deletes: true
    allow_contains_searches: true
    allow_external_references: true
    bulk_export_enabled: true
    bulk_import_enabled: false
    default_pretty_print: false
    enable_index_missing_fields: true
    etag_support_enabled: true
    fhir_version: R4
    graphql_enabled: true
    ig_runtime_upload_enabled: true
    inline_resource_storage_below_size: 4000
    install_transitive_ig_dependencies: true
    implementationguides:
      bfarm:
        name: fhir.bfarm.de
        installMode: STORE_AND_INSTALL
        reloadExisting: false
        version: 2.0.2
    mdm_enabled: false
    openapi_enabled: false
    reuse_cached_search_results_millis: -1
    search-coord-core-pool-size: 20
    search-coord-max-pool-size: 100
    search-coord-queue-capacity: 200
    server_address: http://localhost:8080
    server_auth_token: 126ca7cc-8978-4cb9-be3f-1810e97a0a6f
    subscription:
      resthook_enabled: false
      websocket_enabled: false
    supported_resource_types:
      - Attachment
      - Basic
      - CatalogEntry
      - ChargeItemDefinition
      - CodeSystem
      - DeviceDefinition
      - NamingSystem
      - OperationDefinition
      - Organization
      - Questionnaire
      - QuestionnaireResponse
      - StructureDefinition
      - Subscription
      - ValueSet
    validation:
      requests_enabled: true
      responses_enabled: false
…
2024-01-31 08:01:12.540 [main] WARN  c.u.f.j.p.PackageInstallerSvcImpl [PackageInstallerSvcImpl.java:258] Failed to upload resource of type StructureDefinition with ID null - Error: ca.uhn.fhir.jpa.packages.ImplementationGuideInstallationException: HAPI-1290: Failure when generating snapshot of StructureDefinition: null
2024-01-31 08:01:12.542 [main] WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext [AbstractApplicationContext.java:591] Exception encountered during context initialization - cancelling refresh attempt: 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 25; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'packageInstaller' 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.packages.IPackageInstallerSvc]: Factory method 'packageInstaller' threw exception; nested exception is ca.uhn.fhir.jpa.packages.ImplementationGuideInstallationException: HAPI-1286: Error installing IG fhir.bfarm.de#2.0.2: ca.uhn.fhir.jpa.packages.ImplementationGuideInstallationException: HAPI-1290: Failure when generating snapshot of StructureDefinition: null
2024-01-31 08:01:12.559 [main] INFO  c.u.f.j.c.HapiFhirLocalContainerEntityManagerFactoryBean [AbstractEntityManagerFactoryBean.java:651] Closing JPA EntityManagerFactory for persistence unit 'HAPI_PU'
2024-01-31 08:01:12.574 [main] INFO  com.zaxxer.hikari.HikariDataSource [HikariDataSource.java:350] HikariPool-1 - Shutdown initiated...
2024-01-31 08:01:12.578 [main] INFO  com.zaxxer.hikari.HikariDataSource [HikariDataSource.java:352] HikariPool-1 - Shutdown completed.
2024-01-31 08:01:12.595 [main] INFO  o.s.b.a.l.ConditionEvaluationReportLoggingListener [ConditionEvaluationReportLoggingListener.java:136]

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2024-01-31 08:01:12.621 [main] ERROR o.s.boot.SpringApplication [SpringApplication.java:821] Application run failed
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 25; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'packageInstaller' 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.packages.IPackageInstallerSvc]: Factory method 'packageInstaller' threw exception; nested exception is ca.uhn.fhir.jpa.packages.ImplementationGuideInstallationException: HAPI-1286: Error installing IG fhir.bfarm.de#2.0.2: ca.uhn.fhir.jpa.packages.ImplementationGuideInstallationException: HAPI-1290: Failure when generating snapshot of StructureDefinition: null

…

Caused by: ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HAPI-0888: org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerValidationSupport$ExpansionCouldNotBeCompletedInternallyException: HAPI-0702: Unable to expand ValueSet because CodeSystem could not be found: urn:ietf:bcp:13
    at ca.uhn.fhir.jpa.term.TermReadSvcImpl.expandValueSetHandleIncludeOrExclude (TermReadSvcImpl.java:1039)
    at ca.uhn.fhir.jpa.term.TermReadSvcImpl.lambda$doExpandValueSet$2 (TermReadSvcImpl.java:923)
    at org.springframework.transaction.support.TransactionOperations.lambda$executeWithoutResult$0 (TransactionOperations.java:68)
    at org.springframework.transaction.support.TransactionTemplate.execute (TransactionTemplate.java:140)
    at org.springframework.transaction.support.TransactionOperations.executeWithoutResult (TransactionOperations.java:67)
    at ca.uhn.fhir.jpa.term.TermReadSvcImpl.doExpandValueSet (TermReadSvcImpl.java:923)
    …
XcrigX commented 9 months ago

The error message indicates that this CodeSystem is missing: "HAPI-0702: Unable to expand ValueSet because CodeSystem could not be found: urn:ietf:bcp:13"

Does that CodeSystem exist in your server already, or is it an artifact in the IG?

sebastianhelbig commented 9 months ago

urn:ietf:bcp:13 is one of the standard code systems listed here: https://hl7.org/fhir/R4/terminologies-systems.html. I was under the impression that these could just be used?

XcrigX commented 9 months ago

No - any that you are using would need to be loaded.

sebastianhelbig commented 9 months ago

Thanks a lot. I got it working now.