No Such Bean exception on initializer

Hey @ibacher @dkayiwa @mksd @ruhanga , i am working on Add new FhirContactPoints domain. by mherman22 · Pull Request #253 · mekomsolutions/openmrs-module-initializer (github.com). However, i am having a blocker on how to get by the above mentioned error as can be seen at java.lang.IllegalStateException: Failed to load ApplicationContext at org. - Pastebin.com.

It looks to be caused by

  1. Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘serviceRequestTranslatorImpl’: Unsatisfied dependency expressed through field ‘taskService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fhirTaskServiceImpl’: Unsatisfied dependency expressed through field ‘searchQueryInclude’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘searchQueryInclude’: Unsatisfied dependency expressed through field ‘locationService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fhirLocationServiceImpl’: Unsatisfied dependency expressed through field ‘translator’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘locationTranslatorImpl’: Unsatisfied dependency expressed through field ‘locationTypeTranslator’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘org.openmrs.module.fhir2.api.translators.LocationTypeTranslator’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

@mherman22 could you make sure to provide the required fhir2 api .jar dependencies scoped as provided in the conditional submodule introduced as part of the PR?

Maybe you just need that module marked as required in your config.xml file

I thought that’s provided for in the parent module.

Could you try and confirm that it fails with the same errors @mherman22?

Or do you intend to consume the version specified in the parent pom <fhir2Version>1.6.0</fhir2Version> for the sub-module introduced…?

I did and it returned the same error.

Actually I am changing the fhir2Version in the parent module to 1.11.0 since the FhirContactPoints are introduced there

@mherman22 - the FHIR2 module has several submodules, and you need to ensure you have the appropriate ones included. Specifically here, since you are creating an Iniz submodule that is based on OpenMRS 2.6, you need to look to see if the FHIR2 module has any submodules that are specific to OpenMRS 2.6+. And indeed the FHIR2 module does have such an artifact.

I would recommend using the pom provided in the api-2.5 submodule as a guide as to how to do this.

Specifically, see how the api-2.5 pom of initializer includes all of the initializer submodules that are related to OpenMRS 2.5 and under, and also see how it includes the fhir2-api-2.5 submodule:

So you will need to included similar in your api-2.6 pom, but include also fhir2-api-2.6

2 Likes

Thanks @mseaton, i have done much of the stuff detailed above however the issue persists.

I have even gone ahead and ensured the fhir2 module version (1.6.0) in the parent module doesn’t change and ensured the api-2.6 runs on fhir2:1.11.0 as can be seen in this commit:

It still fails with the same error.

sorry i missed adding this:

    <dependency>
        <groupId>org.openmrs.module</groupId>
        <artifactId>fhir2-api-2.5</artifactId>
        <version>${fhir2Version}</version>
        <scope>provided</scope>
    </dependency>

I now skip that huddle as earlier reported in this talkpost. Thanks

A few things that would help @mherman22 .

  1. I tried checkout out your branch on your fork in the hope that you had a failing unit test that demonstrated this issue, but I don’t see one. I do see another unit test failing (LoadersOrderTest) with the error no loader for domain FHIR_CONTACT_POINT_MAP was found . So, in order to properly help you to investigate, it would be best to have some sort of context-sensitive test that actually tries to start up the context where you can demonstrate this error, and which does not require one to try running the module in an OpenMRS instance.

  2. One thing I see missing is the api-2.5 as a dependency (eg. if you mimicked what was happening in api-2.5 pom that’s good, but then you also need to remember to add the api-2.5 dependency itself). Something like this:

        <dependency>
            <groupId>${project.parent.groupId}</groupId>
            <artifactId>${project.parent.artifactId}-api-2.5</artifactId>
            <version>${project.parent.version}</version>
            <scope>provided</scope>
        </dependency>
1 Like