OpenMRS Installation - Demo data - Error Duplicate entry 'concepts.locked' for key 'PRIMARY'

Hi,

I am running into an SQL error while installing OpenMRS. SQL reports that there is a duplicate entry for ‘concepts.locked’ for key ’ PRIMARY’, see ERROR - Slf4jLogger.severe(22) |2021-04-12T11:29:26,918| Change Set liquibase-sc - Pastebin.com for the full error.

I’ve searched through the demo-data file and as far as I can see there are no duplicates, so I’m lost as to what is causing this. Any help is really appreciated.

With kind regards, Renske van Brummelen

@renskelotte48 could you try to drop the openmrs database and do the installation afresh

Dropping the database caused some weird errors, so reinstalled the whole Linux distribution. Still getting the same error tho…

Which version of OpenMRS are you installing? Could you also share the linux distribution you are having plus also the database server version?

I’m trying to install OpenMRS-core, during the install I chose Reference Application 2.11.0. I’m working on Ubuntu 20.04 and have MySQL 5.7 installed. I checked all dependencies against the release notes and I (should) have the correct versions.

Can you list the exact steps you are going through, starting from scratch (after deleting the openmrs database and runtime properties file)?

In the attachment you can find all steps that I go through from a fresh installation of Ubuntu 20.04. During installation of OpenMRS (in the browser, providing I even get that far without tests crashing), I choose simple install and add demo data. It then gives the error as described before. Yesterday I managed to install a version of OpenMRS under subideal circumstances. I had to skip all tests and I couldn’t add demo data.

(the part in italics is because another process tends to run on port 8080 and changing the port during installation results in it still running on 8080) install guide.docx (15.2 KB)

Does it work if you do not chose to add demo data?

I managed to get it installed by skipping the tests and not adding demo data

I am also getting this error for concepts.locked:

There was an error while updating the database to the latest. file: liquibase-demo-data.xml. Error: Migration failed for change set liquibase-schema-only.xml::1226412230538-11::ben (generated): Reason: liquibase.exception.DatabaseException: Duplicate entry 'concepts.locked' for key 'global_property.PRIMARY' [Failed SQL: (1062) INSERT INTO openmrs.global_property (property, property_value, `description`, uuid) VALUES ('concepts.locked', 'false', 'true/false whether or not concepts can be edited in this database.', 'c97cc1a7-7e03-43b1-892c-385d1b621017')] See the error log for more details

Here is the stacktrace:

WARN - InitializationFilter$InitializationCompletion$1.run(1667) |2021-06-19T10:50:01,604| Error while trying to add demo data
org.openmrs.util.DatabaseUpdateException: There was an error while updating the database to the latest. file: liquibase-demo-data.xml. Error: Migration failed for change set liquibase-schema-only.xml::1226412230538-11::ben (generated):
     Reason: liquibase.exception.DatabaseException: Duplicate entry 'concepts.locked' for key 'global_property.PRIMARY' [Failed SQL: (1062) INSERT INTO openmrs.global_property (property, property_value, `description`, uuid) VALUES ('concepts.locked', 'false', 'true/false whether or not concepts can be edited in this database.', 'c97cc1a7-7e03-43b1-892c-385d1b621017')]
        at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:189) ~[classes/:?]
        at org.openmrs.web.filter.initialization.InitializationFilter$InitializationCompletion$1.run(InitializationFilter.java:1658) [classes/:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_291]
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set liquibase-schema-only.xml::1226412230538-11::ben (generated):
     Reason: liquibase.exception.DatabaseException: Duplicate entry 'concepts.locked' for key 'global_property.PRIMARY' [Failed SQL: (1062) INSERT INTO openmrs.global_property (property, property_value, `description`, uuid) VALUES ('concepts.locked', 'false', 'true/false whether or not concepts can be edited in this database.', 'c97cc1a7-7e03-43b1-892c-385d1b621017')]
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:659) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53) ~[liquibase-core-3.10.3.jar:?]
        at org.openmrs.util.DatabaseUpdater$OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:850) ~[classes/:?]
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:97) ~[liquibase-core-3.10.3.jar:?]
        at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:232) ~[classes/:?]
        at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:185) ~[classes/:?]
        ... 2 more
Caused by: liquibase.exception.DatabaseException: Duplicate entry 'concepts.locked' for key 'global_property.PRIMARY' [Failed SQL: (1062) INSERT INTO openmrs.global_property (property, property_value, `description`, uuid) VALUES ('concepts.locked', 'false', 'true/false whether or not concepts can be edited in this database.', 'c97cc1a7-7e03-43b1-892c-385d1b621017')]
        at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:430) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:87) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:159) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1276) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1258) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:622) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53) ~[liquibase-core-3.10.3.jar:?]
        at org.openmrs.util.DatabaseUpdater$OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:850) ~[classes/:?]
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:97) ~[liquibase-core-3.10.3.jar:?]
        at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:232) ~[classes/:?]
        at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:185) ~[classes/:?]
        ... 2 more
Caused by: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry 'concepts.locked' for key 'global_property.PRIMARY'
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:117) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:764) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648) ~[mysql-connector-java-8.0.22.jar:8.0.22]
        at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:426) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:87) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:159) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1276) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1258) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:622) ~[liquibase-core-3.10.3.jar:?]
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53) ~[liquibase-core-3.10.3.jar:?]
        at org.openmrs.util.DatabaseUpdater$OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:850) ~[classes/:?]
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:97) ~[liquibase-core-3.10.3.jar:?]
        at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:232) ~[classes/:?]
        at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:185) ~[classes/:?]
        ... 2 more

Same error here for the latest codebase. does not work even without using demo data.

Share the server error log via pastebin.com?

@dkayiwa Thanks , that issue is resolved, When I host OpenMRS in ubuntu and use modules for reference application, these error occurs, full stacktrace here INFO - EhCacheManagerFactoryBean.destroy(192) |2021-08-11T16:14:28,558| Shutting - Pastebin.com. Thanks in advance.

Which version of the reference application are you using?

@dkayiwa It is 2.12.0, I copied the modules got from the SDK, tried with war from openmrs-core , working fine in local machine, but no luck in Ubuntu server environment, Thanks.

Use the rest webservices module attached on this ticket and restart OpenMRS.

@dkayiwa Thanks for your help, previous error gone away, but there is another error showing nested exception is java.lang.NoClassDefFoundError: org/openmrs/ui/framework/page/PageRequest

here is the full stack trace, SimpleXStreamSerializer.Security framework of XStream not explicitly initializ - Pastebin.com.

Does it help if you drop the database, delete the runtime properties file, and restart OpenMRS?

Woo, super thank @dkayiwa , Error gone away, wish you have a good day. Really appreciated your help.