java version “1.8.0_121”
Java™ SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot™ 64-Bit Server VM (build 25.121-b13, mixed mode)
I’ve read through everything I can find about the topic including a post on TALK “While installing Openmrs SDK i got an error after running mvn clean install openmrs-sdk:run”. I’ve tried all suggestions but I still get an error setting up a server as follows.
MikeGordon:/ default$ mvn openmrs-sdk:setup -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects…
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — openmrs-sdk-maven-plugin:3.8.2:setup (default-cli) @ standalone-pom —
Setting up a new server…
Specify server id (-DserverId) (default: ‘server’): 1
You can setup the following servers:
Distribution
Platform
Which one do you choose? [1/2]: 2
You can deploy the following versions of a platform:
2.1.0-SNAPSHOT
2.0.4.1
2.0.4
1.12.0
1.11.7
1.10.4
Other…
Which one do you choose? [1/2/3/4/5/6/7]: 1
[INFO] Configured Artifact: org.openmrs.distro:platform:2.1.0-SNAPSHOT:jar
[INFO] Copying platform-2.1.0-SNAPSHOT.jar to /Users/default/openmrs/1/openmrs-distro.jar
[INFO] Configured Artifact: org.openmrs.web:openmrs-webapp:2.1.0-SNAPSHOT:war
[INFO] Copying openmrs-webapp-2.1.0-SNAPSHOT.war to /Users/default/openmrs/1/openmrs-2.1.0-SNAPSHOT.war
[INFO] Configured Artifact: org.openmrs.module:fhir-omod:1.7.0-SNAPSHOT:jar
[INFO] Configured Artifact: org.openmrs.module:webservices.rest-omod:2.17:jar
[INFO] Configured Artifact: org.openmrs.module:owa-omod:1.6.3:jar
[INFO] Copying fhir-omod-1.7.0-SNAPSHOT.jar to /Users/default/openmrs/1/modules/fhir-1.7.0-SNAPSHOT.omod
[INFO] Copying webservices.rest-omod-2.17.jar to /Users/default/openmrs/1/modules/webservices.rest-2.17.omod
[INFO] Copying owa-omod-1.6.3.jar to /Users/default/openmrs/1/modules/owa-1.6.3.omod
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?:
H2
MySQL 5.6 (requires pre-installed MySQL 5.6)
MySQL 5.6 in SDK docker container (requires pre-installed Docker)
The distribution requires MySQL database. Please specify database uri (-DdbUri) (default: ‘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:11 min
[INFO] Finished at: 2017-04-03T21:49:18+09:30
[INFO] Final Memory: 18M/99M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.8.2:setup (default-cli) on project standalone-pom: Failed to setup server: Failed to connect to the specified database jdbc:mysql://localhost:3306/1?autoReconnect=true&sessionVariables=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.8.2:setup (default-cli) on project standalone-pom: Failed to setup server
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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:498)
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:266)
at org.openmrs.maven.plugins.Setup.executeTask(Setup.java:605)
at org.openmrs.maven.plugins.AbstractTask.execute(AbstractTask.java:181)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
… 20 more
Caused by: java.lang.IllegalStateException: Failed to connect to the specified database jdbc:mysql://localhost:3306/1?autoReconnect=true&sessionVariables=storage_engine%3DInnoDB&useUnicode=true&characterEncoding=UTF-8
at org.openmrs.maven.plugins.Setup.setup(Setup.java:206)
… 24 more
[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
Try specifying your server id as “one” instead of “1”. “1” does not seem to be a valid db name and server id is used to construct a db name. Let me know, if it worked so we can add validation.
Could having the following set up interfere with the server connection?
Maven home: /Applications/apache-maven-3.3.9
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre
@mikejg I can create a database the name one, usually a problem occurs when using the username root with a blank password - I would recommend changing the root user to have an actual password
mysql Ver 14.14 Distrib 5.6.35, for macos10.12 (x86_64) using EditLine wrapper
Connection id: 6
Current database:
Current user: default@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ‘’
Using delimiter: ;
Server version: 5.6.35 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 4 hours 56 min 54 sec
Threads: 6 Questions: 116 Slow queries: 0 Opens: 69 Flush tables: 1 Open tables: 62 Queries per second avg: 0.006
mysql> SHOW VARIABLES WHERE Variable_name = ‘port’;
±--------------±------+
| Variable_name | Value |
±--------------±------+
| port | 3306 |
±--------------±------+
1 row in set (0.01 sec)
usage: setup
Description: Setup a new instance of OpenMRS server. It can be used for
setting up a platform or a distribution. It prompts for any missing, but
required parameters.
-DaddDemoData Add demo data when setting up a platform server.
-DdbDriver Database driver e.g. ‘mysql’ or ‘h2’.
-DdbPassword Password for the database user.
-DdbUri Uri for JDBC connection to the database (default
value matches dbDriver)
-DdbUser Username for the database (defaults to ‘root’).
-Ddistro OpenMRS Distribution to setup in a format
‘groupId:artifactId:version’. You can skip
groupId, if it is ‘org.openmrs.distro’.
-Dfile Path to installation.properties file for batch
setup.
-Dplatform OpenMRS Platform version to setup e.g. ‘1.11.5’.
-DserverId Unique id of a server.
usage: deploy
Description: Deploy a module/distribution/platform to a server. It can be
used for deploying a new artifact or upgrading/downgrading an artifact,
which was previosly deployed.
-DartifactId Artifact id of an artifact, which you want to
deploy.
-DgroupId Group id of an artifact, which you want to deploy
(defaults to ‘org.openmrs.module’).
-DserverId Unique id of a server.
-Dversion Version of an artifact, which you want to deploy.
usage: undeploy
Description: Undeploy a module from a server.
-DartifactId Artifact id of a module, which you want to
undeploy.
-DgroupId Group id of a module, which you want to undeploy
(defaults to ‘org.openmrs.module’).
-DserverId Unique id of a server.
usage: reset
Description: Reset server and its database to the initial state.
-Dfull If ‘true’, delete modules installed manually
(defaults to ‘false’).
-Dserverid Unique id of a server.
usage: delete
Description: Delete a server and its database.
-DserverId Unique id of a server.
usage: run
Description: Start a server. If it is run from a module/distro/platform
project, the project will be redeployed before launching.
-Ddebug Enable remote debugging on the given port (defaults
to ‘1044’ if empty).
-Dfork Set to ‘false’ to disable forking a process for
running the server (defaults to ‘true’). Useful for
debugging within an IDE without a remote debugger.
Not that ‘false’ disables the live-reloading
feature.
-Dport Port to use for running the server (defaults to
‘8080’).
-DserverId Unique id of a server.
usage: watch
Description: Add a module from the current directory to the list of
watched projects. It enables the live-reloading feature for a module.
-DserverId Unique id of a server.
usage: unwatch
Description: Remove a module from the list of watched projects. It
disabled the live-reloading feature for a module.
-DartifactId Artifact id of a module to unwatch.
-DgroupId Group id of a module to unwatch. It is optional,
if artifact id is unambiguous.
-DserverId Unique id of a server.
usage: info
Description: Display server details including the list of watched modules.
-DserverId Unique id of a server.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.426 s
[INFO] Finished at: 2017-04-04T00:11:06+09:30
[INFO] Final Memory: 16M/56M
[INFO] -