I’m trying to implement OpenMRS Core 2.5.0 using war file.
I have manually imported openmrs demo data on MySQL (version 8.0.29 on ubuntu 20).
I try to install OpenMRS without creating a database or adding the demo data. So it just needs to update the database, but it fails. Here’s the issue. How I can solve it?
@roozbeh Oh sorry! kindly share your server side log via pastebin.com
Kindly another alternative will be having a new installation without choosing to add demo data.
Thanks a lot for your reply!
I am installing it without adding demo data from installation options. I have added demo data manually.
Here’s the server log for localhost: localhost.2022-07-07.log - Pastebin.com
Here’s the server log for localhost_access_log: localhost_access_log.2022-07-07 - Pastebin.com
@roozbeh Kindly forgive me but what you have shared doesn’t look like an error.
It looks like and INFO statement that prints at startup. Kindly share the entire error log on your terminal using pastebin. Am sorry for a bother!
@jwnasambu oh sorry! But that was the whole log file.
Here is another log file, the catalina.log file: catalina.2022-07-07.log - Pastebin.com
If this is also not what you need, could you please elaborate where I can find that log file? thanks
@roozbeh this is okay. The reason it doesn’t work is because you may be using modularized dependencies with old TomCat version. TomCat (
bcel library) tries to scan class files attempting to find annotations like
@WebServlet and others, but encounters unknown byte code. Kindly which Tomcat version are you running?
@roozbeh Openmrs 2.5.0 supports Tomcat 8.5+ and 9 basing on the release notes on this link. kindly am not certain the version you are running but keep posting the community for more help.
@jwnasambu Oh I see! Thanks a lot! My tomcat version is 7. So I’ll upgrade it and try one more time. Thanks for your help.
Normally, this error happens because you’ve imported an export of an OpenMRS database that has a column definition like:
date_created datetime DEFAULT '0000-00-00 00:00:00'
Versions of MySQL prior to 5.7 accepted all zeroes as a valid date. This was deprecated in 5.7 and, IIRC, support was basically dropped in MySQL 8 unless you just disable constraint checking altogetehr. You’re best bet might be to clean-up the MySQL dump that you manually imported to remove any
DEFAULT '0000-00-00' or
DEFAULT '0000-00-00 00:00:00 declarations and re-import the database.
Another alternative would be this:
Update connection.url in openmrs-runtime.properties, by appending
so that 0000-00-00 00:00:00 dates can be converted to null.
I still could not resolve this problem…
@jwnasambu I also tried Tomcat 10 but the error still exists
@ibacher I am using the published demo data available here: Demo Data - Resources - OpenMRS Wiki
How can I remove those values from this dump?
@dkayiwa I don’t find the openmrs-runtime.properties in the server. Maybe this file is created after installing openmrs? Because in my case, I can not install it at all. I search with
sudo find / -type f -name “openmrs-runtime.properties”
but there is no result.
Correct. You can first do a fresh install and then add demo data.
I tried your suggestion for appending
to the runtime properties but I get this error:
Error Reading Changelog File: /var/cache/tomcat7/Catalina/localhost/openmrs-2-5-0/loader/org/openmrs/liquibase/snapshots/schema-only/liquibase-schema-only-2.4.x.xml (No such file or directory) Error while trying to update to the latest database version
I also tried installing a fresh openmrs without demo data (with only an empty database) but I get this error:
There was an error while updating the database to the latest. file: org/openmrs/liquibase/updates/liquibase-update-to-latest-2.0.x.xml. Error: liquibase.exception.MigrationFailedException: Migration failed for change set liquibase-update-to-latest.xml::1::upul: Reason: liquibase.exception.DatabaseException: Table ‘openmrs.person_attribute_type’ doesn’t exist [Failed SQL: (1146) ALTER TABLE openmrs.person_attribute_type ADD edit_privilege VARCHAR(255) NULL] Error while trying to update to the latest database version
Do you have any recommendations?
Drop the openmrs database, delete the runtime properties file (if it was already created), and then restart tomcat. Then run the openmrs setup wizard again and share the options that you selected from the setup wizard.
I have deleted the runtime properties and openmrs database and tried it again.
My system details: Java 8 - Tomcat 7 - Mysql 8 - OpenMRS enterprise 2.5.0
For OpenMRS configurations, I select the following options:
After these configurations, openmrs creates a new database, creates a new MySQL user, and create tables and core data and the setup finishes successfully (without demo data).
So until now, OpenMRS is installed without demo data. But I need the demo data. So I try to manually add the demo data to the MySQL. I manually add large-demo-data-2-2-1. (I also have tried large-demo-data-1.11.9 but got the same error.) After adding the demo data, I restart the tomcat and go to localhost. But I get this page.
Like I never have installed it!!
To handle this problem, on Tomcat, I “stop” OpenMRS and then “start” it again. Then when I go to OpenMRS page, I confront this
Then I put “admin” and “test” for credentialls and go to this page, which seems to be trying to update to the latest version.
But after trying to update, I’m getting this error.
So any ideas what is my problem? I just want to install a simple OpenMRS enterprise version with the demo data on it. Nothing more!
P.S. I hope my explanations are clear enough and you can easily reproduce the issue.
P.S.2. I haven’t changed the demo data. I just download the file from this link: Demo Data - Resources - OpenMRS Wiki
Those demo datasets do not support the platform version that you are trying to install. The latest version supported, according to the file names, is 2.2.1
Therefore, start by installing openmrs platform version 2.2.1 and load the
large-demo-data-2-2-1 file. After you have run it successfully and are able to log in, upgrade openmrs to the platform version that you want, which in this case is 2.5.0 by replacing the war file you have for 2.2.1 with that of 2.5.0 and then restart tomcat. You will then have 2.5.0 with the demo data that you need. After which, you can help others by uploading the demo data file for 2.5.0 on the wiki page.
Thanks a lot @dkayiwa. It worked!
However, it is a bit unclear to understand that for using the demo data, you should have the platform version of 2.2.1 or before. It might be nice if you could add this information on the webpage of downloading demo data to reduce troubles for future installations.
@roozbeh do you mind giving back by editing the documentation to reflect that?
@dkayiwa Sure, I can do that. How should I do it?