Error: Please check your OpenMRS runtime properties file and make sure you have the correct connection.username and connection.password set

I recently got the above error. In my Properties file I have ensured that my user and password are the same as my MySQL set up, it still does not work. I have tried for weeks to find out the issue here now, I cannot identify it - many solutions involve the aforementioned MySQL set up but this does not solve my problem. Is there any other reason that I may be experiencing this issue?

Full Error:

Error occurred while trying to get the updates needed for the database. Unable to get a connection to the database. Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set java.lang.RuntimeException: Error occurred while trying to get the updates needed for the database. Unable to get a connection to the database. Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:630) at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:587) at org.openmrs.util.DatabaseUpdater.updatesRequired(DatabaseUpdater.java:252) at org.openmrs.web.Listener.setupNeeded(Listener.java:217) at org.openmrs.web.Listener.contextInitialized(Listener.java:179) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5197) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5720) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1327) at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:685) at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:209) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:141) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:604) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:165) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1195) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:654) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:319) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.Exception: Unable to get a connection to the database. Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set at org.openmrs.util.DatabaseUpdater.getLiquibase(DatabaseUpdater.java:361) at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:615) … 38 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2094) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2019) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:776) at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at org.openmrs.util.DatabaseUpdater.getConnection(DatabaseUpdater.java:423) at org.openmrs.util.DatabaseUpdater.getLiquibase(DatabaseUpdater.java:358) … 39 more Caused by: java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password’. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:869) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:865) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1746) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2035) … 53 more

See the server log for full output.

@mozzy, @gcliff, @reagan, @sharif Kindly take a look.

1 Like

@tino i see you are trying to connect your database, you have input incorrect password, or username check your password you set in your mysql orelse you can drop them and create new authentications, feel very free to use pastebin.com and paste full log

1 Like

@tino sorry about that.

  • have you ensured you can connect to you DB with your Credentials ??
  • have you ensured your MySQL instance is started At the time of running your server ??

and what MySQL and OpenMRS versions are you running ??

3 Likes

@tino sorry about this. Honestly, its hard to confirm the would be cause of this error since you didn’t share what you were doing prior . Just in case you are building an SDK instance, ensure where the is an option of default just press enter without typing anything.

You can still access your runtime property file on your machine to confirm the password by following either of the paths.

On Windows systems:

C:\Documents and Settings\YOURUSERNAME\Application Data\OpenMRS
C:\Windows\system32\config\systemprofile\Application Data\OpenMRS

On Mac OS X or Linux systems:

~/YOURUSERNAME/.OpenMRS/usr/share/tomcatX/.OpenMRS
2 Likes

Hi guys thanks for your replies. I found the problem, it seems like openMRS made duplicate properties files - I found and deleted the duplicates and it began working as normal again.

1 Like

Hi tino, I’m facing the same issue and receive the same error, could u please assist and inform how u solved this??

Oh sorry! this error occurs when you don’t set the password to the root while installing mysql or entering a wrong password to the root while installing the sdk instance or while installing the sdk where the is an option of default you typed something. To solve this error, ensure you set the password to the root but just incase you have forgotten it

I’m still unable to set the Openmrs application, this time im trying to set simple set up, where I’m sharing the root password , but it shows me an error stating : * { font-family: Verdana, ‘Lucida Grande’, ‘Trebuchet MS’, Arial, Sans-Serif; } .openmrs_msg { background-color: lightyellow; } .openmrs_error { background-color: lightpink; } .openmrs_msg, .openmrs_error { margin-top: 3px; margin-bottom: 5px; border: 1px dashed lightgrey; padding: 2px 2px 2px 18px; } .question { text-align:left; background-color: #E9E4CC; -moz-border-radius: 5px; -webkit-border-radius: 5px; } .yes { background-color: #7fbaf5; -moz-border-radius: 5px; -webkit-border-radius: 5px; } .no { background-color: #CCCCCC; -moz-border-radius: 5px; -webkit-border-radius: 5px; } .logo { background-image:url(images/openmrs_logo_white.gif); background-repeat:no-repeat; height:98px; left: 3px; } .bar { background-image:url(images/openmrs_barx.gif); background-repeat:repeat-x; height:45px; width:100%; margin-left: 15px; } .bar-round { background-image:url(images/openmrs_bar.gif); background-repeat:no-repeat; height:45px; width:100%; font-size:24px; } .content { margin-top: 10px; } .button{ height:30px; font-size:18px; -moz-border-radius: 15px; -webkit-border-radius: 15px; background-color: #E9E4CC; } .label{ text-align:left; white-space:nowrap; }

Unable to create the database. The password might be incorrect or the database is not started.

???Error executing sql: create database if not exists ? default character set utf8 - Could not create connection to database server. Attempted reconnect 3 times. Giving up.???

log error: Unable to find a runtime properties file at C:\Users\awsbgwinuser1\Desktop\apache-tomcat-9.0.37-windows-x64\apache-tomcat-9.0.37\bin\openmrs-runtime.properties

Never give up! quitters never win. Do you remember your password to the mysql root? if you don’t I shared how you can access it on your computer in the runtime property file.

I dont find runtime property file, in the path its showing…And I remembers the password well. Able to connected over Workbench. log error: Unable to find a runtime properties file at C:\Users\awsbgwinuser1\Desktop\apache-tomcat-9.0.37-windows-x64\apache-tomcat-9.0.37\bin\openmrs-runtime.properties

Please advise

Have you confirmed if MySQL is running with a database you created?

just to note:

  1. Ensure your MySQL is installed and running.

  2. By default the SDK created a DB as your server name.

  3. Ensure in your run time properties file you have the right username(root by default) and coresponding password to what you set in MySQL

Thank you, Now I’m trying to setup UI, for which I downloaded the legacy ui module and pasted that file in appdata\roaming\openmrs\modules folder. However after restating the tomcat server. I get 404 error page.Could u please advie

I like your zeal! first clear the browser cache, and reload the page again. If it fails to build delete the file you added and follow the guide on this link: https://wiki.openmrs.org/display/docs/User+Interface+Modules for a fresh installation.

Alternatively:

  1. Download the git repo from https://github.com/openmrs/openmrs-module-legacyui

  2. Run mvn clean install.

  3. Copy the .omod generated in omod/target folder to your appdata\roaming\openmrs\modules folder before restarting the platform. Lastly, Just in case it doesn’t work feel free to Run the SDK setup again and this time choose Distribution instead of Platform

Kindly try to always share your full error through https://pastebin.com/ or snapshot.

Hi , I tried the advised steps , pasted the catalina log file for your reference , please check :https://pastebin.com/g9rf1Y2h

Have you confirmed if Tomcat is running?

yes, below is the logs in apache server window:

13-Nov-2020 05:49:44.992 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [41708] milliseconds WARN - DispatcherServlet.noHandlerFound(1272) |2020-11-13T05:50:00,771| No mapping for GET /openmrs/ WARN - DispatcherServlet.noHandlerFound(1272) |2020-11-13T05:50:04,092| No mapping for GET /openmrs/ WARN - DispatcherServlet.noHandlerFound(1272) |2020-11-13T05:50:05,527| No mapping for GET /openmrs/ WARN - DispatcherServlet.noHandlerFound(1272) |2020-11-13T05:50:53,026| No mapping for GET /openmrs/

Kindly lets us have a call on this link https://www.uberconference.com/room/openmrs

Joined the meeting