java -Ddw.server.connector.port=8081 -jar my.jar server config.yml
I get:
config.yml has an error:
Failed to parse configuration at: server.connector; Unexpected token (END_OBJECT), expected FIELD_NAME: missing property 'type' that is to contain type id (for class io.dropwizard.jetty.ConnectorFactory)
at [Source: N/A; line: -1, column: -1](through reference chain: com.acmerocket.stratum.StratumConfiguration["server"]->io.dropwizard.server.SimpleServerFactory["connector"])
Without -Ddw.server.connector.port=8081
, the app comes up fine.
I am having the same issue, and the suggestion made by @joschi did not seem to help. Here's the full command:
java -Dserver.applicationConnectors\[0\].port=8080 -cp ...
This gives a large stacktrace, the core of which seems to be:
ERROR [2014-07-22 22:13:46,228] com.sun.jersey.core.spi.component.ProviderFactory: The provider class, class com.sun.jersey.server.impl.model.parameter.multivalued.JAXBStringReaderProviders$RootElementProvider, could not be instantiated. Processing will continue but the class will not be utilized
! java.lang.IllegalArgumentException: argument type mismatch
I tried putting the following in my config file, but received the same error:
server:
applicationConnectors:
- type: http
port: 8090
Update to this: I was able to get '-Ddw.server.applicationConnectors[0].port=8090' working, but only after I had added this same property to my config.yml. For example, if my config.yml has the following:
server:
applicationConnectors:
- type: http
port: 8085
And I run the app with:
-Ddw.server.applicationConnectors[0].port=8090
Then the app starts on port 8090, which is the desired behavior. If you remove the 'server' section from config.yml, however, and pass that same -D argument, the application fails to start with the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Unable to override server.applicationConnectors[0].type; node with index not found.
I was able to get it working like this :
java -Ddw.server.applicationConnectors\[0\].type="http" -Ddw.server.applicationConnectors\[0\].port="8080" -jar target/<UR_JAR>.jar server conf.yml
Dropwizard Version:
<dropwizard.version>1.3.8</dropwizard.version>
I was able to get it working like this :
java -Ddw.server.applicationConnectors\[0\].type="http" -Ddw.server.applicationConnectors\[0\].port="8080" -jar target/<UR_JAR>.jar server conf.yml
Dropwizard Version:
<dropwizard.version>1.3.8</dropwizard.version>
Did you also declare applicationConnectors in your yaml file too?
The PR #866 does not seem to fix this problem here (tried dropwizard version 1.3.12). I.e. you have to specify a config.yml with at least:
server:
applicationConnectors:
- type: http
in order to change the port. Otherwise you'll get:
IllegalArgumentException: Unable to override server.applicationConnectors[0].type; node with index not found