Change port number of Tomcat Server

Sometimes, we have to change the port number on which Tomcat is listening for the http request for some reasons. The reasons might be one of the following:

  1. The default port number 8080 is busy due to other program is working on this port number.
  2. We may try to run two Tomcat server instances simultaneously.
  3. or may be it is just a instruction from your killer boss to test your ability. :)

Do not worry! In this tutorial we will learn how to change the port number of Tomcat server and use the new port number.

Step 1: Go to the directory where you have installed your Tomcat Server and then open the directory with name “conf“.

Step 2: Open the file named “server.xml” with any word processing software like notepad or notepad++.

Step 3: This step will be different for different versions of Tomcat Server:

For Tomcat 6 and above:

Search for the entry shown bellow:


<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

This entry is actually registering a Connector that will handle the protocol “HTTP/1.1″ on the port number 8080.

Change the value of attribute port to your desire value and start the Tomcat Server.


<Connector port="8088" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

For Tomcat 5.5

Search for the entry:


<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />

Change the value of attribute port to your desire value and start the Tomcat Server.

<Connector port="8088" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />

Step 4: Open browser and hit the url

http://localhost:8088

You will get following screen:

Change port number of Tomcat Server

Change port number of Tomcat Server

New port number has been effected in Tomcat Server.

Related Posts:

Leave a comment ?

2 Comments.

  1. Good tutorial. you can also change shutdown port or SSL port of tomcat in similar way. see here for more details How to change default port of tomcat server

  2. Hi.

    I have a problem.
    I’ve changed the port in server.xml because I have this port with other application.
    I start tomcat server from catabalina.bat perfect in the new port.
    I change the port for tomcat in XAMP.INI with the new port.
    Restart the computer.
    And I try again to start tomcat server from XAMP console but I see log as “Busy port – Tomcat 8080″.
    The tomcat server start but I want to avoid this message in the xamp console.
    So when you press de button for going to the tomcat by browser the url is with the old port.

    Where can change the port?
    What Can I do?

Leave a Comment Cancel reply

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>