Saturday 5 January 2013

Changing Tomcat Default Port

Generally, by default Tomcat runs on 8080 port. There are many chances of getting conflicts on port numbers for running programs. So, sometimes we need to change the port number of Tomcat.


Steps to change the port number for Tomcat:

1. Locate "%TOMCAT_FOLDER%/conf/server.xml"

2. Find the below code in the server.xml file


 
    


or


    


3. Change the Connector port=”8080" to any other port number.

    Ex:




This makes to run Tomcat on port number 9090.

4. Save the file and Restart the server.

What Is Tomcat Default Administrator Password ?

Problem:

Is there default administrator Username and Password for Tomcat?

Solution:

You can find the roles and credentials of roles in `tomcat-users.xml`.

By default the Tomcat doesn't enable admin or manager access.

Below is the code:








So, by default no roles are created by Tomcat.

You can create the roles manually. Below is the sample code to enable admin and manager roles.




  
  
  



Paste this code in "%TOMCAT_FOLDER%/conf/tomcat-users.xml" and restart the server. Now, you can access Tomcat admin or manager with username="admin" and password="admin".