smart container with platform 2.0

Application Name: Platform, SmartContainer module Version Number: platform 2.0, smartcontainer-1.0.0 Java Version - java version “1.8.0_141” Tomcat - 9.0.1 OS - Windows

Question: I am new to openmrs and trying to deploy smart container module to the platform 2.0 and running into issues. Any ideas on how to get past this error? Below is the error snippet. Also here is the link for the openmrs log file - opemrs.log

I appreciate your help. Thanks

WARN - Module.expandExtensionNames(546) |2017-10-26 22:46:00,449| smartcontainer: Unable to find class definition for extension: org.openmrs.patientDashboardTab
java.lang.NoClassDefFoundError: org/openmrs/module/web/extension/PatientDashboardTabExt
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:637)
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:556)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.openmrs.module.Module.expandExtensionNames(Module.java:538)
	at org.openmrs.module.Module.getExtensions(Module.java:490)
	at org.openmrs.module.ModuleFactory.startModuleInternal(ModuleFactory.java:664)
	at org.openmrs.api.context.Daemon$1.run(Daemon.java:74)
Caused by: java.lang.ClassNotFoundException: org.openmrs.module.web.extension.PatientDashboardTabExt
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1104)
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:563)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 16 more

ARN - AbstractApplicationContext.refresh(487) |2017-10-26 22:47:46,278| Exception encountered during context initialization - cancelling refresh attempt 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.smartcontainer.web.controller.SmartcontainerPortletController] for bean with name ‘smartAppPortletController’ defined in URL [jar:file:/C:/Users/I_ADMIN/Application%20Data/OpenMRS/.openmrs-lib-cache/smartcontainer/smartcontainer.jar!/moduleApplicationContext.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.smartcontainer.web.controller.SmartcontainerPortletController] for bean with name ‘smartAppPortletController’ defined in URL [jar:file:/C:/Users/I_ADMIN/Application%20Data/OpenMRS/.openmrs-lib-cache/smartcontainer/smartcontainer.jar!/moduleApplicationContext.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 ‘chartSearchService’ defined in URL [jar:file:/C:/Users/I_ADMIN/Application%20Data/OpenMRS/.openmrs-lib-cache/chartsearch/lib/chartsearch-api-2.0.jar!/moduleApplicationContext.xml]: Cannot create inner bean ‘org.openmrs.module.chartsearch.api.impl.ChartSearchServiceImpl#76ab5de9’ of type [org.openmrs.module.chartsearch.api.impl.ChartSearchServiceImpl] while setting bean property ‘target’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.openmrs.module.chartsearch.api.impl.ChartSearchServiceImpl#76ab5de9’ defined in URL [jar:file:/C:/Users/I_ADMIN/Application%20Data/OpenMRS/.openmrs-lib-cache/chartsearch/lib/chartsearch-api-2.0.jar!/moduleApplicationContext.xml]: Cannot create inner bean ‘org.openmrs.module.chartsearch.api.db.hibernate.HibernateChartSearchDAO#ca5e76e’ of type [org.openmrs.module.chartsearch.api.db.hibernate.HibernateChartSearchDAO] while setting bean property ‘dao’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.openmrs.module.chartsearch.api.db.hibernate.HibernateChartSearchDAO#ca5e76e’ defined in URL [jar:file:/C:/Users/I_ADMIN/Application%20Data/OpenMRS/.openmrs-lib-cache/chartsearch/lib/chartsearch-api-2.0.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.springframe

This module is not yet upgraded to support platform 2.x If you have some time, create a ticket and we guide you on what you need to do. https://wiki.openmrs.org/display/docs/Tickets

@dkayiwa Thank you for responding. I just created an Issue. - https://issues.openmrs.org/browse/TRUNK-5227 Please let me know the details to upgrade to 2.x. Thanks.

Now migrate the module from svn to git as instructed here https://wiki.openmrs.org/display/docs/Migrating+to+Git

The svn repository is: http://svn.openmrs.org/openmrs-modules/smartcontainer/

@dkayiwa I could not get the email details of authors and made up this authors.txt? I keep getting an error, git checkout -f master failed. Can you please check authors.txt validity?

authors.txt - https://www.dropbox.com/s/52da59p2gn9jth1/authors.txt?dl=0

I also did try a git svn clone; it failed copying trunk.

git svn clone <removednewmemberurlrestiction>/smartcontainer/ --no-metadata -A authors.txt --stdlayout .

My bad, I found the authors.txt and was able to migrate the code to git. Do you have a link for the next steps? Please let me know

Can you remove the authors.txt, .project and .classpath files from all the subfolders? Then ignore them like here https://github.com/openmrs/openmrs-module-reportingrest/blob/master/.gitignore

@dkayiwa Yes, Just updated the repository.

Now try to compile it using Java 8

I tried compiling with JDK 8 and Platform 2.x. I ran into an issue with the refactoring of Allergy, AllergenType, Severity, Reactions and other classes migrated into the coremrs package. Some of the methods and attributes were deprecated or removed from the package. It would help to understand the refactoring ticket and methods added or deprecated. Attached is the log details - https://pastebin.com/r1vg3jc9 Anyone has ticket or links related to this refactoring? Please let me know.

On a side note, do you mind giving us some background information in regards to what you are planning to use this module for?

I am planning to use this module to understand and develop some smart apps to help impact other peoples live positively and add to the common good openMRS community is doing. I am new to provider domain, interested in learning EMR and figured the best way is to contribute to opensource projects.

What do you think of the comments that @wyclif put on the ticket which are pasted below?

“Documentation for the new order entry API is here, allergies were merged into core as part of TRUNK-4747, how do you plan on getting the module to work? I believe the SMART api it’s using might no longer be supported, I think the project evolved into SMART on FHIR and that’s what you want to implement.”

@dkayiwa @wyclif thanks. Yes, I believe SMART on FHIR is the way to go. The smart app will be hosted separately from OpenMRS server, and we don’t need to migrate smart container as apps will live external to EMR. Open MRS already has OAuth support to help with authorization. I have been reading OpenMRS FHIR support - https://wiki.openmrs.org/display/projects/OpenMRS+FHIR+Module#OpenMRSFHIRModule-CurrentstatusofFHIRsupport to understand gaps for SMART apps support. Based on my understanding most the required FHIR resources and service registration APIs exist, CORS support, Launch context and token management may be the gaps? I am not sure on how to get started? Wondering if I should hardcode the launch context and try deploying the growth chart app? Any thoughts? Please let me know.

The smart container module plays 2 roles i.e. as a container for hosting the SMART apps and also provides the restful API that the apps consume to pull data out of the same OpenMRS instance it’s hosted in, this technically means the smart restful API is not really public. If the SMART apps aren’t going to be hosted in OpenMRS, it basically means the module is no longer needed, your smart apps should be build around SMART on FHIR which should be using the FHIR module to pull data out of OpenMRS.