Issues with initializing the openmrs-core environment

Hello everyone,

I am new to openMRS. I have cloned openmrs-core into my local (Windows 11) and built it.

…\openmrs-core>mvn clean install -DskipTests=true

The built was a success!!

created database as ‘openmrs’ on MySQL on XAMPP and created a new user as ‘openmrs_user’. The following is how I created and granted permission to the user.

CREATE USER ‘openmrs_user’@‘127.0.0.1’ IDENTIFIED BY ‘’;

GRANT ALL PRIVILEGES ON . TO ‘openmrs_user’@‘127.0.0.1’ WITH GRANT OPTION; FLUSH PRIVILEGES;

SHOW GRANTS FOR ‘openmrs_user’@‘127.0.0.1’;

I ran the application as follows;

…\openmrs-core>cd webapp …\openmrs-core\webapp>mvn jetty:run

When I ran the application, I got the following errors (exceptions) on the browser (Chrome).

http://localhost:8080/openmrs

Unable to start OpenMRS. Error thrown was: Should not be here because updates were run previously org.openmrs.module.ModuleException: Unable to start OpenMRS. Error thrown was: Should not be here because updates were run previously at org.openmrs.web.WebDaemon.lambda$startOpenmrs$0(WebDaemon.java:44) at org.openmrs.api.context.Daemon.lambda$runInDaemonThreadInternal$5(Daemon.java:452) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: javax.servlet.ServletException: Should not be here because updates were run previously at org.openmrs.web.Listener.startOpenmrs(Listener.java:353) at org.openmrs.web.WebDaemon.lambda$startOpenmrs$0(WebDaemon.java:42) … 6 more Caused by: org.openmrs.util.DatabaseUpdateException: 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.LiquibaseException: Unable to execute change set: liquibase-update-to-latest.xml::20090402-1517::bwolfe at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:193) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:153) at org.openmrs.api.context.Context.checkForDatabaseUpdates(Context.java:1238) at org.openmrs.api.context.Context.startup(Context.java:941) at org.openmrs.web.Listener.startOpenmrs(Listener.java:350) … 7 more Caused by: liquibase.exception.LiquibaseException: liquibase.exception.LiquibaseException: Unable to execute change set: liquibase-update-to-latest.xml::20090402-1517::bwolfe at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:155) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:245) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:189) … 11 more Caused by: liquibase.exception.LiquibaseException: Unable to execute change set: liquibase-update-to-latest.xml::20090402-1517::bwolfe at org.openmrs.util.DatabaseUpdater$OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:882) at liquibase.changelog.ChangeLogIterator.lambda$run$0(ChangeLogIterator.java:133) at liquibase.Scope.lambda$child$0(Scope.java:201) at liquibase.Scope.child(Scope.java:210) at liquibase.Scope.child(Scope.java:200) at liquibase.Scope.child(Scope.java:179) at liquibase.changelog.ChangeLogIterator.lambda$run$1(ChangeLogIterator.java:122) at liquibase.Scope.lambda$child$0(Scope.java:201) at liquibase.Scope.child(Scope.java:210) at liquibase.Scope.child(Scope.java:200) at liquibase.Scope.child(Scope.java:179) at liquibase.Scope.child(Scope.java:267) at liquibase.Scope.child(Scope.java:271) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:91) … 13 more Caused by: liquibase.exception.MigrationFailedException: Migration failed for changeset liquibase-update-to-latest.xml::20090402-1517::bwolfe: Reason: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.CustomChangeException: java.sql.SQLSyntaxErrorException: Table ‘openmrs.cohort’ doesn’t exist at liquibase.changelog.ChangeSet.execute(ChangeSet.java:840) at liquibase.changelog.visitor.UpdateVisitor.executeAcceptedChange(UpdateVisitor.java:126) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:70) at org.openmrs.util.DatabaseUpdater$OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:879) … 26 more Caused by: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.CustomChangeException: java.sql.SQLSyntaxErrorException: Table ‘openmrs.cohort’ doesn’t exist at liquibase.change.custom.CustomChangeWrapper.generateStatements(CustomChangeWrapper.java:176) at liquibase.executor.AbstractExecutor.execute(AbstractExecutor.java:133) at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1189) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:790) … 29 more Caused by: liquibase.exception.CustomChangeException: java.sql.SQLSyntaxErrorException: Table ‘openmrs.cohort’ doesn’t exist at org.openmrs.util.databasechange.GenerateUuid.execute(GenerateUuid.java:118) at liquibase.change.custom.CustomChangeWrapper.generateStatements(CustomChangeWrapper.java:170) … 32 more Caused by: java.sql.SQLSyntaxErrorException: Table ‘openmrs.cohort’ doesn’t exist at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:763) at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648) at org.openmrs.util.databasechange.GenerateUuid.execute(GenerateUuid.java:113) … 33 more

For me, it seems like some requires tables are missing during the table creation. Meanwhile, during the startup, I found following log messages on my console

INFO - ChangeLogDetective.getInitialLiquibaseSnapshotVersion(96) |2025-02-21T16:33:55,790| identifying the Liquibase snapshot version that had been used to initialize the OpenMRS database… INFO - ChangeLogDetective.getInitialLiquibaseSnapshotVersion(109) |2025-02-21T16:33:55,842| looking for un-run change sets in snapshot version ‘2.6.x’ INFO - Slf4JLogger.log(43) |2025-02-21T16:33:56,354| Creating database history table with name: openmrs.liquibasechangelog INFO - Slf4JLogger.log(43) |2025-02-21T16:34:00,850| Parsed changelog file ‘org/openmrs/liquibase/snapshots/schema-only/liquibase-schema-only-2.6.x.xml’ INFO - Slf4JLogger.log(43) |2025-02-21T16:34:00,886| Reading from openmrs.liquibasechangelog INFO - ChangeLogDetective.getInitialLiquibaseSnapshotVersion(118) |2025-02-21T16:34:01,118| file ‘org\openmrs\liquibase\snapshots\schema-only\liquibase-schema-only-2.6.x.xml’ contains 1014 un-run change sets INFO - Slf4JLogger.log(43) |2025-02-21T16:34:01,596| Parsed changelog file ‘org/openmrs/liquibase/snapshots/core-data/liquibase-core-data-2.6.x.xml’ . . . . I AM PARTICULARLY INTERESTED IN GETTING CLARIFICATION ON THE FOLLOWING SECTION;

INFO - Slf4JLogger.log(43) |2025-02-21T16:34:37,219| Parsed changelog file ‘org/openmrs/liquibase/updates/liquibase-update-to-latest-2.0.x.xml’ INFO - Slf4JLogger.log(43) |2025-02-21T16:34:37,221| Reading from openmrs.liquibasechangelog INFO - Slf4JLogger.log(43) |2025-02-21T16:34:37,249| Creating snapshot WARN - Slf4JLogger.log(41) |2025-02-21T16:34:37,298| Name ‘PK_LIQUIBASECHANGELOGLOCK’ ignored for PRIMARY key. INFO - Slf4JLogger.log(43) |2025-02-21T16:34:37,322| Successfully acquired change log lock INFO - Slf4JLogger.log(43) |2025-02-21T16:34:37,331| Reading from openmrs.liquibasechangelog WARN - Slf4JLogger.log(41) |2025-02-21T16:34:37,856| Due to mariadb SQL limitations, setNullable will lose primary key/autoincrement/not null/comment settings explicitly redefined in the change. Use or to re-specify all configuration if this is the case WARN - Slf4JLogger.log(41) |2025-02-21T16:34:37,856| Due to mariadb SQL limitations, modifyDataType will lose primary key/autoincrement/not null/comment settings explicitly redefined in the change. Use or to re-specify all configuration if this is the case Running Changeset: liquibase-update-to-latest.xml::0::bwolfe INFO - Slf4JLogger.log(43) |2025-02-21T16:34:37,966| Marking ChangeSet: liquibase-update-to-latest.xml::0::bwolfe ran despite precondition error: liquibase-update-to-latest.xml : liquibase.precondition.core.SqlPrecondition@44404dd2 : Table ‘openmrs.global_property’ doesn’t exist

Running Changeset: liquibase-update-to-latest.xml::20090214-2247::isherman INFO - Slf4JLogger.log(43) |2025-02-21T16:34:37,985| Marking ChangeSet: “liquibase-update-to-latest.xml::20090214-2247::isherman” as ran despite precondition failure due to onFail=‘MARK_RAN’: liquibase-update-to-latest.xml : DBMS Precondition failed: expected postgresql, got mariadb liquibase-update-to-latest.xml : DBMS Precondition failed: expected oracle, got mariadb liquibase-update-to-latest.xml : DBMS Precondition failed: expected db2, got mariadb liquibase-update-to-latest.xml : DBMS Precondition failed: expected mssql, got mariadb

Running Changeset: liquibase-update-to-latest.xml::20090402-1516-cohort::bwolfe INFO - Slf4JLogger.log(43) |2025-02-21T16:34:37,990| Marking ChangeSet: “liquibase-update-to-latest.xml::20090402-1516-cohort::bwolfe” as ran despite precondition failure due to onFail=‘MARK_RAN’: liquibase-update-to-latest.xml : DBMS Precondition failed: expected mysql, got mariadb liquibase-update-to-latest.xml : DBMS Precondition failed: expected oracle, got mariadb

Running Changeset: liquibase-update-to-latest.xml::20090402-1516-concept::bwolfe INFO - Slf4JLogger.log(43) |2025-02-21T16:34:38,003| Marking ChangeSet: “liquibase-update-to-latest.xml::20090402-1516-concept::bwolfe” as ran despite precondition failure due to onFail=‘MARK_RAN’: liquibase-update-to-latest.xml : DBMS Precondition failed: expected mysql, got mariadb liquibase-update-to-latest.xml : DBMS Precondition failed: expected oracle, got mariadb

Running Changeset: liquibase-update-to-latest.xml::20090402-1516-concept_answer::bwolfe INFO - Slf4JLogger.log(43) |2025-02-21T16:34:38,011| Marking ChangeSet: “liquibase-update-to-latest.xml::20090402-1516-concept_answer::bwolfe” as ran despite precondition failure due to onFail=‘MARK_RAN’: liquibase-update-to-latest.xml : DBMS Precondition failed: expected mysql, got mariadb liquibase-update-to-latest.xml : DBMS Precondition failed: expected oracle, got mariadb

Running Changeset: liquibase-update-to-latest.xml::20090402-1516-concept_class::bwolfe INFO - Slf4JLogger.log(43) |2025-02-21T16:34:38,022| Marking ChangeSet: “liquibase-update-to-latest.xml::20090402-1516-concept_class::bwolfe” as ran despite precondition failure due to onFail=‘MARK_RAN’: liquibase-update-to-latest.xml : DBMS Precondition failed: expected mysql, got mariadb liquibase-update-to-latest.xml : DBMS Precondition failed: expected oracle, got mariadb

It seems like something to do with MySQL on XAMPP.

Can someone provide me with instructions on how to resolve the above issue? Your further clarifications are welcome.

Thank you.

The simplest way to get started is to let OpenMRS create the database for you and any required users. So run the OpenMRS setup again and choose the Simple Installation Method. After entering the MySQL root password, everything should be as simple as just clicking Next.

Thanks, @dkayiwa, for the prompt response.

I was able to connect the Docker MySQL instance and run the application. I used Jetty Server to run the openmrs-core. There, I encountered failures running Liquibase scripts while running the jetty command (mvn jetty:run). However, I restored “initial_test_db” that comes with openmrs-core source code and successfully ran the application.

Further, I would like to get steps to build and run O3 and connect it with the openmrs-core, which is already running. Could you please provide me with any documentation for those?

Thank you.

Have you first of all been able to create a new instance of O3 and have it running?

Sorry for the late reply. I was able to reach upto this level after setting up the MySQL database with openmrs-core.

However, I am looking for steps to running O3 and connecting it with openmrs-core already running in my environment.

  1. Is this possible?
  2. Can you show me the CLEAR documentation that helps me to connect openmrs-core, which is currently running on my local with O3 (I believe I have to clone and configure openmrs-esm-core to run with my local openmrs-core)?

I am very new to openMRS and went through most of the documentation and videos to understand how this can be done. Unfortunately, I couldn’t find any.

Thank you.

No. I am looking for help to run the O3. Thanks.

Currently we don’t have any documentation on how to run O3 with a SNAPSHOT build of core. That’s not something we’d generally recommend anyway.

Thank you, @ibacher, for the information. Do I need to run O3 with SDK? Is there any reason you don’t recommend running openmrs-core with O3? I believe the following administrative guide helps to customize/configure OpenMRS to suite hospital requirements.

You can, but it’s a complicated setup and, as I said, we don’t have it documented yet.

It’s not that you shouldn’t run openmrs-core with O3. It’s that you shouldn’t run SNAPSHOT builds (so the latest commits to the master branch) with O3, because there are very likely to be incompatibilities that you’ll have to deal with. You should instead use released versions, ideally building from the RefApp.

Thank you @ibacher for the information. Appreciate the clarification.