Am trying to connect to the openmrs server using a Java utility to migrate data from OpenMRS 1.8.2 to OpenMRS refrence app 2.6. I have included dependencies in my pom.xml but am having this error.
Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError: org/openmrs/util/DatabaseUpdateException
at java.security.AccessController.doPrivileged(Native Method)
Caused by: java.lang.ClassNotFoundException: org.openmrs.util.DatabaseUpdateException
… 17 more
Context.startup(“jdbc:mysql://localhost:3306/server2?autoReconnect=true”, username, pass, new Properties());
Keeps throwing exception
ERROR - Context.getServiceContext(250) |2018-05-31 17:04:51,044| serviceContext is null. Creating new ServiceContext()
Exception in thread “Thread-2” org.openmrs.api.APIException: Service not found: interface org.openmrs.messagesource.MessageSourceService
The is what am getting now
With this new exception it probably means that there’s a deeper root cause exception that you can find in the logs, and you’d need to share. Also, I suggest that if you’re asking for dev help then you should post this in the #dev category (since most developers aren’t watching Local categories that they’re not engaged with).
@brightoibe Why don’t you just dump the data using
mysqldump -u root -p server2 > backup.sql
Thanks @ssmusoke. But what am trying to do is to build a small desktop utility that will migrate data from OpenMRS 1.8.2 to OpenMRS refrence app 2.6. The data models and the concepts are quite different. Am tring to connect the Java Swing app to the refrence app and upload the data in csv format.
What we did for UgandaEMR was to develop an SQL migration script which is executed via a batch file, https://github.com/METS-Programme/openmrs-module-aijar/blob/master/tools/src/main/resources/upgrade/updatedatabase_1_9_x.bat
This eliminates the need to develop a custom Java utility to do the same. As long as you can get a connection to the database
Not sure why you have to do this, there is already an upgrade mechanism in OpenMRS that does this for you.
Thanks @wyclif. Will love to see it. My fear is that the concept dictionary of the OpenMRS 1.8.2 is very different from the concept dictionary of the OpenMRS reference app 2.7. If the upgrade mechanism will take care of this, I will be very happy to have it. Please can you shear a link? We have over 200+ sites running OpenMRS 1.8.2 and i need something automated and user friendly.
Thanks for sharing @ssmusoke Will take a look. But note that the concept dictionaries for the OpenMRS 1.8.2 is very different from that of the refrence app 2.7 which is now built around openlabconcepts.
Thanks @darius. I just want to write a java program to ;
- Read a CSV or XML file exported from OpenMRS 1.8.2
- Connect to OpenMRS reference app 2.7 using openlab concepts (different dictionary)
- Import the CSV into OpenMRS using openmrs api in batch processing
- Validate and reject dirty data.
- The utility will be external to OpenMRS and will be discontinued after the imports.
Some of our sites have high patient load and we have about 200+ sites running the OpenMRS 1.8.2.
All I need is a simple class with a main method and a pom.xml file that illustrates basic connection to the refrence app from a standalone lightweigh java app. I am open to learn short cuts and new ideas if this is not nessasary.
@brightoibe as I said, the upgrade scripts will take care of updating the concept related tables and the data will be updated automatically, you don’t have to do it, the reference application assumes a CIEL dictionary and to load that all you need to do is to source the appropriate CIEL SQL dump file.
@brightoibe you should not be worried about the concept dictionary differences, as your app should still work with whatever concepts you have. The concept dictionary is just a reference guide - your data is what matters.