Skip to content

No DAO exists for resource type class Patient/Task > JPA server (v8.2.0) forcefully requires Patient and Task in supported_resource_types #830

@PietroG93

Description

@PietroG93

Hi!

Limiting the loaded resource types via supported_resource_types in application.yml causes a startup failure unless both Patient and Task are included.

Adding Patient to supported_resource_types immediately triggers the same error for Task, forcing me to include both to start the server. It worked well with version 7.6.0 .

I just downloaded the code base from master branch (version 8.2.0) and set up only the following lines in application.yml:

DB Config:

Image

Supported Resources Config:

Image

The selected version is Fhir R4, if I set R5, the problem does not occur and the server works fine without Patient and Task enabled.

The error is:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceMergeService' defined in class path resource [ca/uhn/fhir/jpa/config/r4/JpaR4Config.class]: Failed to instantiate [ca.uhn.fhir.jpa.provider.merge.ResourceMergeService]: Factory method 'resourceMergeService' threw exception with message: No DAO exists for resource type class org.hl7.fhir.r4.model.Patient - Have: {AuditEvent=ca.uhn.fhir.jpa.dao.JpaResourceDao@3c5955bc, ConceptMap=ca.uhn.fhir.jpa.dao.JpaResourceDaoConceptMap@16606fc6, SearchParameter=ca.uhn.fhir.jpa.dao.JpaResourceDaoSearchParameter@6c23df23, CodeSystem=ca.uhn.fhir.jpa.dao.JpaResourceDaoCodeSystem@1f2127ad, ValueSet=ca.uhn.fhir.jpa.dao.JpaResourceDaoValueSet@2485a231}
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1355)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1185)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1364)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1353)
        at ca.uhn.fhir.jpa.starter.Application.main(Application.java:46)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [ca.uhn.fhir.jpa.provider.merge.ResourceMergeService]: Factory method 'resourceMergeService' threw exception with message: No DAO exists for resource type class org.hl7.fhir.r4.model.Patient - Have: {AuditEvent=ca.uhn.fhir.jpa.dao.JpaResourceDao@3c5955bc, ConceptMap=ca.uhn.fhir.jpa.dao.JpaResourceDaoConceptMap@16606fc6, SearchParameter=ca.uhn.fhir.jpa.dao.JpaResourceDaoSearchParameter@6c23df23, CodeSystem=ca.uhn.fhir.jpa.dao.JpaResourceDaoCodeSystem@1f2127ad, ValueSet=ca.uhn.fhir.jpa.dao.JpaResourceDaoValueSet@2485a231}
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:178)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644)
        ... 19 common frames omitted

Caused by: java.lang.NullPointerException: No DAO exists for resource type class org.hl7.fhir.r4.model.Patient - Have: {AuditEvent=ca.uhn.fhir.jpa.dao.JpaResourceDao@3c5955bc, ConceptMap=ca.uhn.fhir.jpa.dao.JpaResourceDaoConceptMap@16606fc6, SearchParameter=ca.uhn.fhir.jpa.dao.JpaResourceDaoSearchParameter@6c23df23, CodeSystem=ca.uhn.fhir.jpa.dao.JpaResourceDaoCodeSystem@1f2127ad, ValueSet=ca.uhn.fhir.jpa.dao.JpaResourceDaoValueSet@2485a231}
        at java.base/java.util.Objects.requireNonNull(Objects.java:334)
        at org.apache.commons.lang3.Validate.notNull(Validate.java:1037)
        at ca.uhn.fhir.jpa.api.dao.DaoRegistry.getResourceDao(DaoRegistry.java:116)
        at ca.uhn.fhir.jpa.provider.merge.ResourceMergeService.<init>(ResourceMergeService.java:79)
        at ca.uhn.fhir.jpa.config.r4.JpaR4Config.resourceMergeService(JpaR4Config.java:119)
        at ca.uhn.fhir.jpa.config.r4.JpaR4Config$$SpringCGLIB$$0.CGLIB$resourceMergeService$0(<generated>)
        at ca.uhn.fhir.jpa.config.r4.JpaR4Config$$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:348)
        at ca.uhn.fhir.jpa.config.r4.JpaR4Config$$SpringCGLIB$$0.resourceMergeService(<generated>)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146)
        ... 20 common frames omitted

A Strange behavior that i saw but i don't know if it is related to, is that the server logs the initialization of both R4 and R5 context but on 7.6.0 this didn't happen.

Image

Image

What can i do?
Is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions