Reference application crashed after adding module

Application Name: Reference Application Version Number: 2.11

Question: Hello, I am using java 1.8.0_151 with tomcat 9. I have installed successfully the reference application and I start add in module. On some module , soory I did notice which one , the application crashed with the following stack trace.

org.openmrs.module.ModuleException: Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘messageSourceServiceTarget’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘mutableResourceBundleMessageSource’ while setting bean property ‘activeMessageSource’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘mutableResourceBundleMessageSource’ defined in class path resource [applicationContext-service.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor#0’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘transactionInterceptor’ while setting bean property ‘transactionInterceptor’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionInterceptor’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘transactionManager’ while setting bean property ‘transactionManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public java.util.Map org.openmrs.api.db.hibernate.HibernateSessionFactoryBean.interceptors; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.openmrs.module.providermanagement.controller.CustomPersonRelationshipsPortletController] for bean with name ‘customPersonRelationshipsPortletController’ defined in URL [jar:file:/var/lib/OpenMRS/.openmrs-lib-cache/providermanagement/providermanagement.jar!/webModuleApplicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/openmrs/web/controller/PortletController Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.openmrs.module.providermanagement.controller.CustomPersonRelationshipsPortletController] for bean with name ‘customPersonRelationshipsPortletController’ defined in URL [jar:file:/var/lib/OpenMRS/.openmrs-lib-cache/providermanagement/providermanagement.jar!/webModuleApplicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/openmrs/web/controller/PortletController Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘fhir.FHIRHelperService’ defined in URL [jar:file:/var/lib/OpenMRS/.openmrs-lib-cache/fhir/fhir.jar!/moduleApplicationContext.xml]: Cannot create inner bean ‘org.openmrs.module.fhir.api.impl.FHIRHelperServiceImpl#515be288’ of type [org.openmrs.module.fhir.api.impl.FHIRHelperServiceImpl] while setting bean property ‘target’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.openmrs.module.fhir.api.impl.FHIRHelperServiceImpl#515be288’ defined in URL [jar:file:/var/lib/OpenMRS/.openmrs-lib-cache/fhir/fhir.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean ‘dbSessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dbSessionFactory’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘sessionFactory’ while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘sessionFactory’: FactoryBean which is currently in creation returned null from getObject Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘providerManagementService’ defined in URL [jar:file:/var/lib/OpenMRS/.openmrs-lib-cache/providermanagement/providermanagement.jar!/moduleApplicationContext.xml]: Cannot create inner bean ‘org.openmrs.module.providermanagement.api.impl.ProviderManagementServiceImpl#372657f0’ of type [org.openmrs.module.providermanagement.api.impl.ProviderManagementServiceImpl] while setting bean property ‘target’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.openmrs.module.providermanagement.api.impl.ProviderManagementServiceImpl#372657f0’ defined in URL [jar:file:/var/lib/OpenMRS/.openmrs-lib-cache/providermanagement/providermanagement.jar!/moduleApplicationContext.xml]: Cannot create inner bean ‘org.openmrs.module.providermanagement.api.db.hibernate.HibernateProviderManagementDAO#539a4e84’ of type [org.openmrs.module.providermanagement.api.db.hibernate.HibernateProviderManagementDAO] while setting bean property ‘dao’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.openmrs.module.providermanagement.api.db.hibernate.HibernateProviderManagementDAO#539a4e84’ defined in URL [jar:file:/var/lib/OpenMRS/.openmrs-lib-cache/providermanagement/providermanagement.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean ‘dbSessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dbSessionFactory’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘sessionFactory’ while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘sessionFactory’: FactoryBean which is currently in creation returned null from getObject Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘providerSuggestionService’ defined in URL [jar:file:/var/lib/OpenMRS/.openmrs-lib-cache/providermanagement/providermanagement.jar!/moduleApplicationContext.xml]: Cannot create inner bean ‘org.openmrs.module.providermanagement.api.impl.ProviderSuggestionServiceImpl#6227edb7’ of type [org.openmrs.module.providermanagement.api.impl.ProviderSuggestionServiceImpl] while setting bean property ‘target’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ’

any help is appreciated

I any help is aprreciated

Can you give the details of your system .?

Also can you try deleting everything , including cache folders and do a fresh install.

NoClassDefFoundError: org/openmrs/web/controller/PortletController can you point us to to the source of your module?

Hi @dkayiwa ,

I just read through this thread as I am having a similar issue in an attempt to install the messaging module (openmrs-module-messaging/messaging-1.0.omod at master · openmrs/openmrs-module-messaging · GitHub)

Please find below:

 
Message Error creating bean with name 'sessionFactory': Unsatisfied dependency expressed through field 'interceptors'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.openmrs.module.messaging.web.controller.MessagingDashboardTabController] for bean with name 'messagesPatientDashboardTab' defined in URL [jar:file:/Users/****/openmrs/server/.openmrs-lib-cache/messaging/messaging.jar!/webModuleApplicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDe

fFoundError: org/openmrs/web/controller/PortletController type or paste code here


would appreciate if you could help with a fix or alternative omod I can use.

I plan to expose an API so the mobile can call to send email notifications.

Regards,
Ola

Am not aware of anyone who is maintaining this module. Are you taking up the development of this module?

Hi @dkayiwa ,

Thanks a lot for your quick response.

I will try to see if I can fix the bug in the current repo but in the mean time, I was hoping there was an alternative I can use in the interim.

Regards

The other option is to fully describe what you are trying to achieve, or your use case. Just in case there is a better solution.

1 Like

I am trying to expose an endpoint the mobile app can call to send email? Or is there a notification service that works both on the server-side and mobile

Hi @dkayiwa ,

I’ve been able to sort this out by creating a new module that exposes a rest endpoint that sends email.

All good now.

Thanks

That is awesome! Is that module publicly available?

Hi @dkayiwa ,

Not yet, but will make it public soon.

Happy to send to whoever needs it in the interim.

Regards,