Troubleshooting OpenMRS

"Error Could not acquire change log lock" when installing or running database updates

When running each database changeset update, liquibase creates a row in the database table liquibasechangeloglock to prevent other applications/jars/users from trying to run updates at the same time. If Tomcat or OpenMRS crashes while an update is running, then the row will not be removed (unlocked). So the next time you start up you will see this error.

Solution

  1. Clear out all rows in the libuibasechangeloglock table. With a command line SQL client, run the following command:
    drop table liquibasechangeloglock;

    If you normally use a GUI client for MySQL, find the liquibasechangeloglock table and drop it. Liquibase will recreate the table with the appropriate row during the next run.


  2. Restart OpenMRS (e.g., restart Tomcat) and load the page again.

OpenMRS modules and settings disappear and reappear on reboot

A default Windows install of OpenMRS places its modules and properties files in "%APPDATA%\OpenMRS\". Where "APPDATA" is the home directory Application Data folder of the user that is running Tomcat.

Chances are your install is like most Windows installs, so the OpenMRS folder will be "C:\Documents and Settings\Your Username\Application Data\OpenMRS\". It is often the case that this account is in the Administrators group. Some Windows installs also have a default (but hidden) Administrator account (username: administrator, password: none) which under some circumstances can be used by Tomcat. In this case, the OpenMRS will be looking for its modules in the "C:\Application Data\OpenMRS\" folder. It will not find them there and thus modules and settings will not be loaded.

Solution

These problems stem from Windows services being run under the Local System account of the machine on which they are installed. Configure the Apache Tomcat service to start under a specific user account rather than the default "Local System Account". This can be configured in the Services window in Control Panel, Administrative Tools. You should use the same user account when running the installer. 

Some module pages throw java.lang.ClassNotFoundException

There is an incompatibility between OpenMRS and versions of Tomcat later than 6.0.29, that means that modules which rely on custom EL functions will throw this exception. If encountering such an issue you should check which version of Tomcat you are using and if necessary downgrade to 6.0.29.