Technical Details of OpenMRS upgrade from 2.1.7 to 2.4.2
The below wiki page list down the technical details of the openmrs 2.4.2 upgrade
List of libraries upgraded from OpenMRS 2.1.7 to 2.4.2
Below are the list of libraries that got upgraded as part of latest OpenMRS 2.4.2 upgrade.
| OpenMRS 2.1.7 (Current Bahmni Version) | OpenMRS 2.4.2 | |
---|---|---|---|
1 | Spring | 3.2.7 RELEASE | 5.2.9 |
2 | Hibernate | 4.3.9 | 5.4.21 |
3 | Java |
8 | 8 (has support for 9, 10, 11, 12, 13, 14, 15) |
4 | FHIR | Fhir module | Fhir2 module, support for fhir 4 module |
5 | Liquibase | 2.0 | 3.10.2 |
6 | Mysql | 5.6, 5.7 | 5.6 (has support for latest 8.0) |
7 | Postgres | No Support | 8.2 (has support for up to the latest 12) |
8 | Tomcat | 6.0.26 | 6.0.26 |
9 | Log4j | 2.17.1 | 2.17.1 |
10 | JUnit | 4.12 | 5 |
Please refer to the pom.xml for list of both OpenMRS and Bahmni modules that got upgraded as part of the OpenMRS 2.4.2.
Basic and Optional Modules List
For Bahmni to up and running and to able to access the EMR modules like reg, clinical, programs, IPD, Admin, Patient Doc Upload, Radiology upload below modules needs to be part of the distro.
We have divided modules into 2 parts
Basic Modules
Optional Modules
Basic Modules by Stage: The below are the set of modules that are required to bring Bahmni up and running. The below table depicts the dependency graph of the modules. With every stage we should be able to see the openmrs UI loading fine. At the end of the Stage 5 we should be able to see Bahmni UI loading fine.
| Basic Modules in each Stage (1-5) |
---|---|
1 |
|
2 |
|
3 |
|
4 |
Note: 1. reference-data-0.94-SNAPSHOT.omod Requires both emrapi-1.32.0.omod, openmrs-atomfeed-2.6.2-SNAPSHOT.omod) 2. emrapi-1.32.0.omod requires providermanagement-2.13.0.omod |
5 |
Note: Bahmni-core Requires bedmanagement, auditlog, episodes, bacteriology, rulesengine, owa modules |
Optional Modules: These are the modules can be added based on the functionality we need and these modules doesn’t have direct dependency of loading other modules as we have seen in the basic moduels.
Appointments Module
Operation Theatre Module
Bahmni.ie.apps module
FHIR2
FHIR2-extension module(depends on FHIR2)
Upgrade Strategy
We have followed incremental upgrade strategy where the approach is to upgrade one version at a time(eg: 2.1.6 to 2.2.0) in all the Bahmni basic modules and build the module successfully.
Steps for upgrade (for single omod)
Upgrade openmrs version in a omod( eg: bahmni-core.omod)
Handle all the API breaking changes as per the openmrs version in the module
Fix all the failing unit test cases as per the OpenMRS changes.
Fix all the failing integration test cases as per the OpenMRS changes
For Optional modules we followed direct upgrade of OpenMRS version from 2.1.7 to 2.4.2
Once the upgrade is done for basic modules we tried to bring up the Bahmni env with all the basic modules. Once the env is stable then we incrementally added the upgraded optional modules.
List of issues faced during the upgrade
We have divided issues into below three categories
Module upgrade time issues(from one openmrs version to other)
Run time env issues(with Openmrs 2.4.2)
API Changes
Module upgrade time issues
Integration tests would fail with bean creation exception. The below snippet needs to be added in the TestingApplicationContext.xml
<property name="packagesToScan">
<list>
<value>org.openmrs</value>
</list>
</property>
2. Change <ref local>
property to <ref bean>
tag because of spring upgrade in moduleApplicationContext.xml
3. javax-servlet requires version upgrade
If we see the below error as part of running the integration tests upgrade javax-servlet version to from 2.x to 4.1
ava.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getHeader(Ljava/lang/String;)Ljava/lang/String;
4. Spring class annotation updation because of spring version upgrade
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
toorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping
toorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
5. mockStatic Issue, getting mockStatic function from below two libraries, Needed to use the one coming from PowerMockito for fixing tests
org.mockito.Mockito.mockStatic from mockito-core:3.5.11
org.powermock.api.mockito.PowerMockito.mockStatic from powermock-api-mockito2:2.0.7
6. Strict null checking in test mocks after JUnit upgrade
https://github.com/openmrs/openmrs-module-bedmanagement/pull/59/commits/2d99a781fce9243b8f7b29b7dddcf6c21a3ee5d0
7. Remove deprecated spring annotation to resolve runtime errors
https://github.com/Bahmni/openmrs-module-episodes/commit/ef39e696319364842612aafefe80c48581681990
8. As per migration in openmrs of renaming column name from precise to allow_decimal needed to make migration changes
https://github.com/Bahmni/bacteriology/commit/8cfae96cd2293bfbdbb81fed40cd571ff8dce1ce
9. Upgrade powermock-api-mockito to powermock-api-mockito2 in pom.xml
Runtime Issues
Module is not loading because of the failing liquibase migration. Check the openmrs.log or openmrs modules UI page to get to the specific failing migration. Please check this card for more details.
Spring bean creation exception as shown in the code snippet.
Eg: 1. more than one bean is available for the specific class
2. No qualifying bean available.
Resolution:
more than one bean is available for the specific class: This issue would come if the bean is instantiated through moduleapplicationContext.xml (through
component-scan
) and @Autowire the same bean. So the spring would find two instances of the same class and not able to select one.No qualifying bean available: bean instantiated to @Component might not work sometime. Make sure the bean is injected through moduleapplicationContext.xml or class constructor
API Changes
Program attribute type, patient program, patientProgram attribute moved from bahmni-core to openmrs-core repositores. So the respective package names requires change.
Patient Program Attribute Resource moved from bahmni-core to webservices.rest. The existing API would work. No change required.
Condition table schema has changed. New columns got added and change in the exiting column name.
Steps to upgrade custom module
Update library versions and module versions in the pom.xml file along with openmrs-core version. Please refer to this section for the versions. Eg: openmrs-core version needs to be updated to 2.4.2 in the pom.xml file of the custom module
Change the mockito versions as per the pom.xml from bahmni-core/pom.xml
Fix the compile time issues: Make sure
there are no compile time issues once we have updated the relevant module versions in the pom.xml file.
api/pom.xml and omod/pom.xml has module versions are parameterised and passed from main module pom.xml
Note: Please refer to the API change section to see whether any packages are moved from bahmni to openmrs repo’s. Based on that make the relevent changes.
4. Fix the unit test cases: Make sure the test cases are passing with the module changes.
Note: Refer to Module upgrade time issues section
5. Fix the integration test cases: Please check this section for any issues.
By the end of the above steps we should have the module build has passed and the upgrade of the openmrs 2.4.2 is completed in the custom module. Now deploy the omod file in the Bahmni env and restart the openmrs service.
Note: Refer to run time issues section if the module has not loaded
The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)