How to change Jetty default port

In Jetty, almost all of configuration information is by default maintained in file jetty.xml, this file is located under $JETTY_HOME/etc/. The  default port in jetty is 8080.

Steps of changing the Jetty Port?

1. Open this file and find the below statement:

2. Change property jetty.port to the port number what you expect, the following one is the example that port is being changed to 8888.

     <New class="org.mortbay.jetty.nio.SelectChannelConnector">
       <Set name="host"><SystemProperty name="jetty.host" /></Set>
       <Set name="port"><SystemProperty name="jetty.port" default="8888"/></Set>
       <Set name="maxIdleTime">30000</Set>
       <Set name="Acceptors">2</Set>
       <Set name="statsOn">false</Set>
       <Set name="confidentialPort">8443</Set>
       <Set name="lowResourcesConnections">5000</Set>
       <Set name="lowResourcesMaxIdleTime">5000</Set>
     </New>

3. Save this file. Restart Jetty. Done

Оцените статью
ASJAVA.COM
Добавить комментарий

Your email address will not be published. Required fields are marked *

*

code