Failed to connect to specified database while setting up sever

(Reagan patrick Makoba) #1

Hello Everyone, Iam facing a challenge trying to set up server after a successful openmrs sdk build. I have tried the different solutions offered here at talk but with no success. Am using mysql 5.7.26 on my windows machine and the steps i have used and errors are reflected below.

C:\Windows\System32>mvn openmrs-sdk:setup -e [INFO] Error stacktraces are turned on. [INFO] Scanning for projects… [INFO] [INFO] ------------------< org.apache.maven:standalone-pom >------------------- [INFO] Building Maven Stub Project (No POM) 1 [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] — openmrs-sdk-maven-plugin:3.13.2:setup (default-cli) @ standalone-pom —

Setting up a new server…

Specify server id (-DserverId) (default: ‘server’): server1

You can setup the following servers:

  1. Distribution
  2. Platform

Which one do you choose? [1/2]: 1

You can deploy the following versions of distribution:

  1. Reference Application 2.3.1
  2. Reference Application 2.2
  3. Reference Application 2.1
  4. Other…

Which one do you choose? [1/2/3/4]: 1 [INFO] Configured Artifact: org.openmrs.web:openmrs-webapp:1.11.5:war [INFO] Copying openmrs-webapp-1.11.5.war to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\openmrs-1.11.5.war [INFO] Configured Artifact: org.openmrs.module:htmlformentry19ext-omod:1.6.1:jar [INFO] Configured Artifact: org.openmrs.module:reportingrest-omod:1.5:jar [INFO] Configured Artifact: org.openmrs.module:metadatadeploy-omod:1.5:jar [INFO] Configured Artifact: org.openmrs.module:serialization.xstream-omod:0.2.10:omod [INFO] Configured Artifact: org.openmrs.module:registrationapp-omod:1.3:jar [INFO] Configured Artifact: org.openmrs:event-omod:2.2.1:jar [INFO] Configured Artifact: org.openmrs.module:uilibrary-omod:2.0.4:jar [INFO] Configured Artifact: org.openmrs.module:htmlwidgets-omod:1.7.0:jar [INFO] Configured Artifact: org.openmrs.module:dataexchange-omod:1.3.1:jar [INFO] Configured Artifact: org.openmrs.module:appui-omod:1.4:jar [INFO] Configured Artifact: org.openmrs.module:allergyui-omod:1.2:jar [INFO] Configured Artifact: org.openmrs.module:providermanagement-omod:2.3:jar [INFO] Configured Artifact: org.openmrs.module:appointmentschedulingui-omod:1.0.3:jar [INFO] Configured Artifact: org.openmrs.module:formentryapp-omod:1.2:jar [INFO] Configured Artifact: org.openmrs.module:idgen-omod:3.2:jar [INFO] Configured Artifact: org.openmrs.module:allergyapi-omod:1.3:jar [INFO] Configured Artifact: org.openmrs.module:metadatamapping-omod:1.0.2:jar [INFO] Configured Artifact: org.openmrs.module:chartsearch-omod:1.4.1:jar [INFO] Configured Artifact: org.openmrs.module:htmlformentryui-omod:1.3:jar [INFO] Configured Artifact: org.openmrs.module:referencedemodata-omod:1.4.1:jar [INFO] Configured Artifact: org.openmrs.module:emrapi-omod:1.11.1:jar [INFO] Configured Artifact: org.openmrs.module:referenceapplication-omod:2.3:jar [INFO] Configured Artifact: org.openmrs.module:htmlformentry-omod:2.6:jar [INFO] Configured Artifact: org.openmrs.module:appframework-omod:2.4:jar [INFO] Configured Artifact: org.openmrs.module:referencemetadata-omod:2.3.1:jar [INFO] Configured Artifact: org.openmrs.module:coreapps-omod:1.7:jar [INFO] Configured Artifact: org.openmrs.module:reporting-omod:0.9.8.1:jar [INFO] Configured Artifact: org.openmrs.module:adminui-omod:1.0:jar [INFO] Configured Artifact: org.openmrs.module:registrationcore-omod:1.2:jar [INFO] Configured Artifact: org.openmrs.module:appointmentscheduling-omod:1.4:jar [INFO] Configured Artifact: org.openmrs.module:webservices.rest-omod:2.12:jar [INFO] Configured Artifact: org.openmrs.module:calculation-omod:1.1:jar [INFO] Configured Artifact: org.openmrs.module:atlas-omod:2.1:omod [INFO] Configured Artifact: org.openmrs.module:uicommons-omod:1.7:jar [INFO] Configured Artifact: org.openmrs.module:uiframework-omod:3.4:jar [INFO] Configured Artifact: org.openmrs.module:metadatasharing-omod:1.1.10:jar [INFO] Copying htmlformentry19ext-omod-1.6.1.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\htmlformentry19ext-1.6.1.omod [INFO] Copying reportingrest-omod-1.5.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\reportingrest-1.5.omod [INFO] Copying metadatadeploy-omod-1.5.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\metadatadeploy-1.5.omod [INFO] Copying serialization.xstream-omod-0.2.10.omod to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\serialization.xstream-0.2.10.omod [INFO] Copying registrationapp-omod-1.3.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\registrationapp-1.3.omod [INFO] Copying event-omod-2.2.1.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\event-2.2.1.omod [INFO] Copying uilibrary-omod-2.0.4.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\uilibrary-2.0.4.omod [INFO] Copying htmlwidgets-omod-1.7.0.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\htmlwidgets-1.7.0.omod [INFO] Copying dataexchange-omod-1.3.1.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\dataexchange-1.3.1.omod [INFO] Copying appui-omod-1.4.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\appui-1.4.omod [INFO] Copying allergyui-omod-1.2.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\allergyui-1.2.omod [INFO] Copying providermanagement-omod-2.3.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\providermanagement-2.3.omod [INFO] Copying appointmentschedulingui-omod-1.0.3.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\appointmentschedulingui-1.0.3.omod [INFO] Copying formentryapp-omod-1.2.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\formentryapp-1.2.omod [INFO] Copying idgen-omod-3.2.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\idgen-3.2.omod [INFO] Copying allergyapi-omod-1.3.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\allergyapi-1.3.omod [INFO] Copying metadatamapping-omod-1.0.2.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\metadatamapping-1.0.2.omod [INFO] Copying chartsearch-omod-1.4.1.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\chartsearch-1.4.1.omod [INFO] Copying htmlformentryui-omod-1.3.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\htmlformentryui-1.3.omod [INFO] Copying referencedemodata-omod-1.4.1.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\referencedemodata-1.4.1.omod [INFO] Copying emrapi-omod-1.11.1.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\emrapi-1.11.1.omod [INFO] Copying referenceapplication-omod-2.3.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\referenceapplication-2.3.omod [INFO] Copying htmlformentry-omod-2.6.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\htmlformentry-2.6.omod [INFO] Copying appframework-omod-2.4.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\appframework-2.4.omod [INFO] Copying referencemetadata-omod-2.3.1.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\referencemetadata-2.3.1.omod [INFO] Copying coreapps-omod-1.7.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\coreapps-1.7.omod [INFO] Copying reporting-omod-0.9.8.1.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\reporting-0.9.8.1.omod [INFO] Copying adminui-omod-1.0.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\adminui-1.0.omod [INFO] Copying registrationcore-omod-1.2.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\registrationcore-1.2.omod [INFO] Copying appointmentscheduling-omod-1.4.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\appointmentscheduling-1.4.omod [INFO] Copying webservices.rest-omod-2.12.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\webservices.rest-2.12.omod [INFO] Copying calculation-omod-1.1.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\calculation-1.1.omod [INFO] Copying atlas-omod-2.1.omod to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\atlas-2.1.omod [INFO] Copying uicommons-omod-1.7.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\uicommons-1.7.omod [INFO] Copying uiframework-omod-3.4.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\uiframework-3.4.omod [INFO] Copying metadatasharing-omod-1.1.10.jar to C:\Users\DE-PRINCE LAPTOPS\openmrs\server1\modules\metadatasharing-1.1.10.omod

What port would you like your server to use? (default: ‘8080’): 8080

If you want to enable remote debugging by default when running the server, specify the port number here (e.g. 1044). Leave blank to disable debugging. (Do not do this on a production server) (default: ‘no debugging’): 1044

Which database would you like to use?:

  1. MySQL 5.6 (requires pre-installed MySQL 5.6)
  2. MySQL 5.6 in SDK docker container (requires pre-installed Docker)
  3. Existing docker container (requires pre-installed Docker)

Which one do you choose? [1/2/3]: 1

The distribution requires MySQL database. Please specify database uri (-DdbUri) (default: ‘jdbc:mysql://localhost:3306/@DBNAME@’): jdbc:mysql://localhost:3306/@DBNAME@

Please specify database username (-DdbUser) (default: ‘root’): root Please specify database password (-DdbPassword) (default: ’ '): [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:09 min [INFO] Finished at: 2019-05-01T09:41:43+03:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.13.2:setup (default-cli) on project standalone-pom: Failed to setup server: Failed to connect to the specified database jdbc:mysql://localhost:3306/server1?autoReconnect=true&sessionVariables=default_storage_engine%3DInnoDB&useUnicode=true&characterEncoding=UTF-8 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.13.2:setup (default-cli) on project standalone-pom: Failed to setup server at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to setup server at org.openmrs.maven.plugins.Setup.setup (Setup.java:276) at org.openmrs.maven.plugins.Setup.executeTask (Setup.java:630) at org.openmrs.maven.plugins.AbstractTask.execute (AbstractTask.java:191) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: java.lang.IllegalStateException: Failed to connect to the specified database jdbc:mysql://localhost:3306/server1?autoReconnect=true&sessionVariables=default_storage_engine%3DInnoDB&useUnicode=true&characterEncoding=UTF-8 at org.openmrs.maven.plugins.Setup.setup (Setup.java:213) at org.openmrs.maven.plugins.Setup.executeTask (Setup.java:630) at org.openmrs.maven.plugins.AbstractTask.execute (AbstractTask.java:191) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

C:\Windows\System32>

anyhelp rendered is highly welcome. @k.joseph@dkayiwa

OpenMRS showing database connection error
Unable to find a runtime properties file
(JONATHAN AJAL ODORA) #2

@reagan Can you have this at https://pastebin.com/ so its easier to look at your error logs?

1 Like
(Reagan patrick Makoba) #3

Here is the link to pastebin.

https://pastebin.com/ahczjwbv

(JONATHAN AJAL ODORA) #4

Did you set a password for MySQL as you installed it?

1 Like
(Herbert Yiga) #5

@reagan you are using a wrong url (jdbc:mysql://localhost:3306/@DBNAME@ ) .have you created any database and what is its name?

2 Likes
(Moses Mutesasira) #6
  • you need to ensure you have installed MySQL 5.6 database and its running.

  • Now by default , MySQL creates a default user root, but with no password.

  • you’ll ensure , you create a password for the root user in your MySql , and use the same password to setup the server database connection

1 Like
(Moses Mutesasira) #7

Another option is creating another user in your MySQL other than root, and create a password for it.

Then instead of using the default user root in setting up your server database connection , use the other user you created in your MySQL with the corresponding password.

(Reagan patrick Makoba) #8

Yes I did…however when am running the server setup I don’t get the option to put it…secondly I have MySQL 5.7 and not 5.6 as seen in the set up…

(Reagan patrick Makoba) #9

I read thru one of the discussions and it indicated that by default in the url…it will create a database using the name I used for server…otherwise I tried that(creating a database which I tried to use in the url and it still failed…

(Moses Mutesasira) #10

:slightly_smiling_face: , well it appears as though the command line is not responding , when you reach the option of putting in the password. but you just continue to type in the right password

(Moses Mutesasira) #11

yes , the default URL provided is fine. just feed in the right coresponding password for the database user you have used which is by default root.

(JONATHAN AJAL ODORA) #12

That’s right @mozzy just continue to type the password @reagan you gave for the DB and then press enter so you can have it connect to the database, don’t bother about not seeing the typing and then tell us how far it goes.

1 Like
(Moses Mutesasira) #13

@herbert24, its fine if he uses the default url generated by the SDK. the only problem comes with putting in a wrong/empty password for the Db-User

(Reagan patrick Makoba) #14

thank you so much devs…am now up and running…the issue was that the command line was just not showing my password as i typed but it has connected after i typed it anyway…respect and cheers…:smiley:

4 Likes