Running jar with server cli command won't work

19 views
Skip to first unread message

Aaron Carson

unread,
Jun 8, 2020, 7:19:44 PM6/8/20
to dropwizard-user
(Note: Initially I deleted this post when I found the answer, but later decided to re-post it so I could share the answer with any interested parties.)

I followed the dropwizard tutorial here: https://www.dropwizard.io/en/latest/getting-started.html#running-your-application
And developed the following test project: https://github.com/aaroncarsonart/MySqlQueryEngine

Attempting to run the jar with the following command:

java -jar target/MySqlQueryEngine-1.0-SNAPSHOT.jar server msqe.yaml

I am getting the following -h output as though I didn't provide server and the config file.

usage: java -jar MySqlQueryEngine-1.0-SNAPSHOT.jar
       [-h] [-v] {server,check} ...

positional arguments:
  {server,check}         available commands

named arguments:
  -h, --help             show this help message and exit
  -v, --version          show the application version and exit

Is my project missing something to get the server to run?

Aaron Carson

unread,
Jun 8, 2020, 7:24:00 PM6/8/20
to dropwizard-user
The culprit was: I forgot to copy the arguments from main into the run method of my Application class:
https://github.com/aaroncarsonart/MySqlQueryEngine/blob/master/src/main/java/com/aaroncarsonart/msqe/MsqeApplication.java#L9-L11

    public static void main(String[] args) throws Exception {
       
MsqeApplication application = new MsqeApplication();
        application
.run(); // needs to be: application.run(args);
   
}


All I needed was a rubber duck to explain the problem to and some time to figure it out myself.  Thank you to anyone who read this and considered the problem before I found the answer.
Reply all
Reply to author
Forward
0 new messages