Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-pluginFailed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin

am getting this error failed to setup my server Which database would you like to use?:

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

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

Preparing ‘openmrs-sdk-mysql-v3-2’ DB docker container… [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 03:48 min [INFO] Finished at: 2021-09-12T12:38:59+03:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:4.1.1:setup (default-cli) on project standalone-pom: Failed to setup server: Unable to execute mojo: Execution null of goal org.openmrs.maven.plugins:openmrs-sdk-docker-maven-plugin:4.1.1:create-mysql failed: [ERROR] [ERROR] [ERROR] Could not connect to Docker at tcp://127.0.0.1:2375/ [ERROR] [ERROR] Please make sure Docker is running. [ERROR] [ERROR] If you are using ‘Docker Toolbox’, please make sure you run the SDK command [ERROR] from the ‘Docker Toolbox’ terminal. [ERROR] [ERROR] If your Docker is running, try resetting the Docker host by running setup with -DdockerHost parameter. [ERROR] [ERROR] You can also set it manually by adding -DdockerHost=“tcp://correct/url”: org.apache.hc.client5.http.HttpHostConnectException: Connect to http://127.0.0.1:2375 [/127.0.0.1] failed: Connection refused: connect [ERROR] → [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [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] MojoExecutionException - Apache Maven - Apache Software Foundation

Do you have Docker installed an running on your machine?

@ibacher yah its running but that error has failed

Hey devs! decided to have this here since its a similar discussion going on here, Am trynna set up a server using OpenMRS SDK for a distribution , however im not sure where i could be going wrong. checkout the steps i followed when trying to setting up the server and the error is there as you scroll This is the error → [ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:4.1.1:setup (default-cli) on project standalone-pom: Failed to setup server: Failed to connect to the specified database jdbc:mysql://localhost:3306/test?autoReconnect=true&sessionVariables=default_storage_engine%3DInnoDB&useUnicode=true&characterEncoding=UTF-8 -> [Help 1]

cc: @kdaud @ibacher

Kindly run the following commands and share the output

1. del C:\Users\DELL\.m2\settings.xml

2. mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:4.1.1:setup-sdk

3. mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:setup-sdk -U

so this is what i get when i follow the steps given → Please specify database username (-DdbUser) (default: 'root'): Please specify - Pastebin.com

Kindly the error you are getting is the same as that of @ndacyayisenga. Kindly scroll up on this thread and you will see some guidance on how to solve this issue provided by @dkayiwa and @ibacher.

use defualt values as sugested in the log and make sure you have downloaded and running mysql so that you create a data base connection and continue

Basically, the error message boils down to this:

Could not connect to Docker at tcp://127.0.0.1:2375/

Docker runs an HTTP server that’s necessary for Docker clients (like the docker cli tool and the Maven plugin the SDK uses) to talk to the Docker daemon. Usually, this is accessible at /var/run/docker.sock (on Linux and macOS) for http://localhost:2375/ (on Windows). If the Docker client can’t connect to Docker, it can’t really do what it’s supposed to do.

If that’s the case and you still want to run an instance of MySQL in Docker for OpenMRS to use, you can just create a MySQL container on your machine, e.g., like this:

run --name mysql-5 -e MYSQL_ROOT_PASSWORD=12345678 -p 3306:3306 -h mysql-5 --restart always -d mysql:5.6 --character-set-server=utf8 --collation-server=utf8_unicode_ci

And then, when running the SDK, just select option 1 as if you had MySQL installed locally.

I might suggest exactly what I suggested here.

1 Like

hey @ibacher @jwnasambu thanks for your help devs.

This is how i solved it on my end:-

i created a new user called root2 and granted him all the privileges and kept note of the password assigned to him and when i went through the steps to setup a server using sdk, it built successfully. thanks

Hey @mherman22 is this from a database perspective or you created a new user on your machine in general?? cc @kdaud

I created a new mysql user and dropped the default user called root

Refer to How to Create MySQL User and Grant Privileges in 2023

How to create a msql user

And Deleting a msql user

Hey there am having a similar problem i successfully installed openmrs but the part where i have to create my first module has failed to work i need help

Kindly do you mind sharing the error you getting in your terminal using pastebin?

1 Like

ohh dearly beloved friends of the openmrs friends , i figured out the solution for my problem and am now running the openmrs sdk on my computer

If this is the case, you need to delete the openmrs-sdk-maven plugin located in the plugins folder ~/.m2/repository/org/openmrs/maven/plugins. then restart your server mvn openmrs-sdk:run [SERVER_ID]