Change Dropwizard default ports-open source projects dropwizard/dropwizard
Ferran Maylinch
From the command line, you can set them this way, in Dropwizard 0.6:
java -Ddw.http.port=9090 -Ddw.http.adminPort=9091 -jar yourapp.jar server yourconfig.yml
If you use Dropwizard 0.7, the system properties are set this way:
java -Ddw.server.applicationConnectors[0].port=9090 -Ddw.server.adminConnectors[0].port=9091 -jar yourapp.jar server yourconfig.yml
I seems that, if you configure ports through system properties, you also need to set them in the yml (the system property takes precedence, anyway). At least that’s happening to me in Dropwizard 0.7. Example of the YAML port configuration:
server:
applicationConnectors:
- type: http
port: 8090
adminConnectors:
- type: http
port: 8091
If you don’t put those ports in the YAML, Dropwizard complains:
Exception in thread "main" java.lang.IllegalArgumentException: Unable to override server.applicationConnectors[0].port; node with index not found.