2

I just want to configure jetty to listen to more than one port. I don't want multiple instances nor multiple webapps, just one jetty, one webapp, but listening to 2 or more ports.

The default way does not support multiple entries:

<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>

Thank you for your help!

1 Answer 1

2

In your jetty.xml you have something like this

<Call name="addConnector">
  <Arg>
      <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <Set name="host"><Property name="jetty.host" default="x.y.z.v"/></Set>
        <Set name="port"><Property name="jetty.port" default="80"/></Set>
        <Set name="maxIdleTime">300000</Set>
        <Set name="Acceptors">2</Set>
        <Set name="statsOn">false</Set>
        <Set name="confidentialPort">8443</Set>
        <Set name="lowResourcesConnections">20000</Set>
        <Set name="lowResourcesMaxIdleTime">5000</Set>
      </New>
  </Arg>
</Call>

Just duplicate this block and change the port in the duplicate.

5
  • That was my first approach, however, something didn't work. Now I tried it again, without problems. Thanks! Aug 2, 2011 at 6:24
  • I've tried the same thing - but cannot get jetty to listen on additional ports
    – warren
    Dec 18, 2014 at 18:56
  • if it matters, I'm on Jetty 6.1 (an older app I am not in the position of being able to update)
    – warren
    Dec 18, 2014 at 19:33
  • How to do the same thing in Jetty 10? Sep 26, 2022 at 15:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .