mekomsolutions / openmrs-module-initializer

The OpenMRS Initializer module is an API-only module that processes the content of the configuration folder when it is found inside OpenMRS' application data directory.
MIT License
23 stars 79 forks source link

Add domains for FHIR Concept Source URLs and patient identifier systems #186

Closed ibacher closed 2 years ago

ibacher commented 2 years ago

Adds domains for a couple of simple mapping tables we use in the FHIR2 module.

ibacher commented 2 years ago

I've added a major refactoring of the LoadersOrderTest. Basically, the test should still have the same assertions (i.e., that each loader specifies an unequivocal order, that each loader is for a recognised domain and that every domain has an associated loader). However, this is now done in such a way that simply registering the loader as a Spring component and adding the domain to the Domain enum will enforce these checks.

mogoodrich commented 2 years ago

@ibacher we are seeing a startup error with the PIH EMR (which is running the latest snapshot of Iniz) after this commit... do things start up okay for you?

`The following error occurred at startup: Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fhirPatientIdentifierSystemLineProcessor': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.pis.FhirPatientIdentifierSystemLineProcessor] from ClassLoader [{ModuleClassLoader: uid=1479380482; initializer}] org.openmrs.module.ModuleException: Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fhirPatientIdentifierSystemLineProcessor': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.pis.FhirPatientIdentifierSystemLineProcessor] from ClassLoader [{ModuleClassLoader: uid=1479380482; initializer}] at org.openmrs.web.WebDaemon.startOpenmrs(WebDaemon.java:65) at org.openmrs.web.Listener.contextInitialized(Listener.java:236) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: javax.servlet.ServletException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fhirPatientIdentifierSystemLineProcessor': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.pis.FhirPatientIdentifierSystemLineProcessor] from ClassLoader [{ModuleClassLoader: uid=1479380482; initializer}] at org.openmrs.web.Listener.startOpenmrs(Listener.java:308) at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fhirPatientIdentifierSystemLineProcessor': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.pis.FhirPatientIdentifierSystemLineProcessor] from ClassLoader [{ModuleClassLoader: uid=1479380482; initializer}] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:289) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1290) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1205) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) at org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:885) at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:844) at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:652) at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:632) at org.openmrs.web.Listener.startOpenmrs(Listener.java:300) ... 1 more Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.initializer.api.fhir.pis.FhirPatientIdentifierSystemLineProcessor] from ClassLoader [{ModuleClassLoader: uid=1479380482; initializer}] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:267) ... 17 more Caused by: java.lang.NoClassDefFoundError: org/openmrs/module/fhir2/model/FhirPatientIdentifierSystem at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.getDeclaredMethods(Class.java:1975) at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ... 19 more Caused by: java.lang.ClassNotFoundException: org.openmrs.module.fhir2.model.FhirPatientIdentifierSystem at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1859) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1702) at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:564) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 23 more

See the server log for full output.`

mogoodrich commented 2 years ago

"Caused by: java.lang.ClassNotFoundException: org.openmrs.module.fhir2.model.FhirPatientIdentifierSystem" seems to be the root error

ibacher commented 2 years ago

@mogoodrich Whoops... looks like a left a critical bit out in this PR. Thanks for the quick find. Should be fixed by 3d7e174.

mogoodrich commented 2 years ago

Thanks @ibacher ! You can thank our CI for the quick find... :)