Archive for the ‘Tomcat’ Category


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="8000" 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="8000" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
HIGHEST PORT VALUE IS 65535
<Connector port="65535" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
below 1024 are reserved and utilized by tomcat so better to use sttarting 
port number from 1024 to 65535
Advertisements