openmrsdb data migration into docker (bahmni-standard)

Hello, I am helping a hospital using Bahmni who are looking into what it will take to do a migration to the docker version of Bahmni when it is released. I have migrated their openmrs database to a working install of Bahmni 0.93, and am now trying to migrate the data to bahmni-standard on docker.

Here are the steps taken:

  1. Install bahmni docker (mostly based on this page)
  2. Created a dump of the openmrs database on 0.93 using this command:
mysqldump --routines -u root -pXXXX --databases openmrs | gzip > openmrs_093_backup.sql.gz
  1. Transferred this file to the docker server
  2. Started up the openmrsdb: docker compose up -d openmrsdb
  3. Dropped the openmrs database:
echo 'DROP DATABASE IF EXISTS openmrs;' | mysql -h localhost -P 3306 --protocol=tcp -u openmrs-user -pXXX
  1. Imported the new database:
gunzip -c /root/openmrs_093_backup.sql.gz | mysql -h localhost -P 3306 --protocol=tcp -u root -pXXX
  1. Then start up all the images.

The logs for the openmrs image show the liquibase changes being applied, and then the search index being rebuilt. But when it finishes openmrs starts to generate a large number of errors, something like the following:

...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.openmrs.module.reporting.dataset.query.service.BaseDataSetQueryService#46c8499d' defined in URL [jar:file:/openmrs/data/.openmrs-lib-cache/reporting/reporting.jar!/moduleApplicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.IllegalStateException: Unable to load cache item
...
Related cause:
	org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountService' defined in URL [jar:file:/openmrs/data/.openmrs-lib-cache/emrapi/lib/emrapi-api-1.32.0.jar!/moduleApplicationContext.xml]: Cannot create inner bean 'org.openmrs.module.emrapi.account.AccountServiceImpl#5bc513d1' of type [org.openmrs.module.emrapi.account.AccountServiceImpl] while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.openmrs.module.emrapi.account.AccountServiceImpl#5bc513d1' defined in URL [jar:file:/openmrs/data/.openmrs-lib-cache/emrapi/lib/emrapi-api-1.32.0.jar!/moduleApplicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.sun.proxy.$Proxy411 implementing org.openmrs.api.OpenmrsService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy,java.io.Serializable,org.springframework.transaction.interceptor.TransactionalProxy' to required type 'org.openmrs.module.providermanagement.api.ProviderManagementService' for property 'providerManagementService'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'com.sun.proxy.$Proxy411 implementing org.openmrs.api.OpenmrsService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy,java.io.Serializable,org.springframework.transaction.interceptor.TransactionalProxy' to required type 'org.openmrs.module.providermanagement.api.ProviderManagementService' for property 'providerManagementService': no matching editors or conversion strategy found
...
	Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.openmrs.module.emrapi.account.AccountServiceImpl#5bc513d1' defined in URL [jar:file:/openmrs/data/.openmrs-lib-cache/emrapi/lib/emrapi-api-1.32.0.jar!/moduleApplicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.sun.proxy.$Proxy411 implementing org.openmrs.api.OpenmrsService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy,java.io.Serializable,org.springframework.transaction.interceptor.TransactionalProxy' to required type 'org.openmrs.module.providermanagement.api.ProviderManagementService' for property 'providerManagementService'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'com.sun.proxy.$Proxy411 implementing org.openmrs.api.OpenmrsService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy,java.io.Serializable,org.springframework.transaction.interceptor.TransactionalProxy' to required type 'org.openmrs.module.providermanagement.api.ProviderManagementService' for property 'providerManagementService': no matching editors or conversion strategy found
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
		at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:374)
		... 177 more
	Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.sun.proxy.$Proxy411 implementing org.openmrs.api.OpenmrsService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy,java.io.Serializable,org.springframework.transaction.interceptor.TransactionalProxy' to required type 'org.openmrs.module.providermanagement.api.ProviderManagementService' for property 'providerManagementService'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'com.sun.proxy.$Proxy411 implementing org.openmrs.api.OpenmrsService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy,java.io.Serializable,org.springframework.transaction.interceptor.TransactionalProxy' to required type 'org.openmrs.module.providermanagement.api.ProviderManagementService' for property 'providerManagementService': no matching editors or conversion strategy found
...

(More in pastebin)

The log file was able to fill the ~45GB of the image before it crashed.

It would be great to have help knowing why these happen and what can be done about it.

Thanks!

@mohant is coordinating an online training session on this topic of migrating data from older Bahmni instances to the latest one. Details to be announced soon.

1 Like

Hi @gsluthra @mdg583

I’m getting a similar error while trying to start openmrs on bahmni-standard. Is there any fix for this error?

Is there any documentation and steps to follow for data migration from bahmni 0.92 to bahmni-standard docker as we have implemented the Bahmni more than 13 hospitals and need to upgrade the bahmni 0.92 to docker all sites to align with community version upgrade as well as centos 7.6 has been end of life and creating so many problems on customization as well as on initial setup. @angshuonline @gsluthra

Check here for the upcoming sessions. Also check this WIKI page

1 Like

I restore the openmrs from bahmni 0.92 with mysql 5.7 to docker with mysql-8.0 by following the wiki for migration and got error on localhost/openmrs UI. @mohant

The following error occurred at startup: Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘serviceContext$child#6’ defined in URL [jar:file:/openmrs/data/.openmrs-lib-cache/bahmni.ie.apps/lib/bahmni.ie.apps-api-1.4.0-SNAPSHOT.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean ‘bahmniFormService’ while setting bean property ‘moduleService’ with key [1]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘bahmniFormService’ available org.openmrs.module.ModuleException: Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘serviceContext$child#6’ defined in URL [jar:file:/openmrs/data/.openmrs-lib-cache/bahmni.ie.apps/lib/bahmni.ie.apps-api-1.4.0-SNAPSHOT.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean ‘bahmniFormService’ while setting bean property ‘moduleService’ with key [1]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘bahmniFormService’ available at org.openmrs.web.WebDaemon.startOpenmrs(WebDaemon.java:69) at org.openmrs.web.Listener.contextInitialized(Listener.java:243) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4492) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4950) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:711) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:688) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:661) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903) 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 ‘serviceContext$child#6’ defined in URL [jar:file:/openmrs/data/.openmrs-lib-cache/bahmni.ie.apps/lib/bahmni.ie.apps-api-1.4.0-SNAPSHOT.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean ‘bahmniFormService’ while setting bean property ‘moduleService’ with key [1]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘bahmniFormService’ available at org.openmrs.web.Listener.startOpenmrs(Listener.java:315) at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘serviceContext$child#6’ defined in URL [jar:file:/openmrs/data/.openmrs-lib-cache/bahmni.ie.apps/lib/bahmni.ie.apps-api-1.4.0-SNAPSHOT.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean ‘bahmniFormService’ while setting bean property ‘moduleService’ with key [1]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘bahmniFormService’ available at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:428) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:173) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1702) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1447) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) 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:661) at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:641) at org.openmrs.web.Listener.startOpenmrs(Listener.java:307) … 1 more Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘bahmniFormService’ available at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:816) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1288) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330) … 20 more

@utsavdeshar The logs seems to be partial, can you dump the complete logs of openmrs service to a file and share

openmrslog.txt (3.3 MB) @mohant I have attache the log file of openmrs and current I have been using bahmni core from GitHub - NepalEHR/bahmni-core: Core OpenMRS modules for Bahmni (including ERP & ELIS Atom Feed Clients) for my 0.92 which has done some customization. Do I need to migrate my bahmni-core to docker compatible bahmicore with GitHub - Bahmni/bahmni-core: Core OpenMRS modules for Bahmni (including ERP & ELIS Atom Feed Clients)?

I can still see that the logs are partial. If you have a custom module, then we recommend first building a custom openmrs distro image with your modules and then attempt the restore. Also, can you please validate if the services come up properly without restore ?

With default setup of docker its working fine. The issue arise after the db restore from version 0.92 with mysql 5.7 openmrs.