How to start Jetty from command line with different ports for http and https

12,803

Solution 1

Note...that is really old version of jetty, we are releasing milestones for jetty 9 today even.

regardless, look in the jetty.xml and you should see where there is a property defined for jetty.port, just make a similar property for jetty.ssl.port or the like and then use that.

the jetty.xml file should be very easy to read, though thinking back you might need to look in the jetty-ssl.xml file.

Solution 2

  1. first do:

    mvn package

  2. To start the server with default port: 8080 do

    mvn jetty: run

  3. To specify an alternative port: 8090

    mvn jetty: run -Djetty.port=8090

  4. To specify multiple transfer protocol port

    mvn jetty: run -Djetty.port=8090 -Djetty.ssl.port=8555

Share:
12,803
pashgol pashgolian
Author by

pashgol pashgolian

Updated on June 04, 2022

Comments

  • pashgol pashgolian
    pashgol pashgolian almost 2 years

    I already use -Djetty.port=xxx to set the http port on command line but I also need to specify a different port for https. I got some hints online about jetty.ssl.port and aleady tried -Djetty.ssl.port=yyy but that did not work.

    As to why provide ports on command line versus the config xml file, it's because depending on some conditions I need to start Jetty on certain ports.

    I'm using Jetty 6.1-SNAPSHOT.

    Ultimately I need something like: java -Djetty.port=XXX -Djetty.ssl.port=YYY -jar start.jar

  • pashgol pashgolian
    pashgol pashgolian over 11 years
    ah, that did it. In my jetty.xml I had jetty.port in my both socketConnector sections. I changed SslSocketConnector to have jetty.ssl.port and used java -Djetty.port=XXX -Djetty.ssl.port=YYY -jar start.jar to kick it off. Thank you. And sorry about using an old version of jetty. That came bundled with solr. I guess when we update solr we update jetty too.