JavaBeat

  • Home
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Privacy
  • Contact Us

How To Change Tomcat Default Port Configuration?

December 18, 2013 by Krishna Srinivasan Leave a Comment

Tomcat uses by default on port number 8080 on your computer. It is very common that you would have conflict of port number if there is another service running on the same port. You can change the port number for your tomcat server by changing in the configuration file or through the eclipse editor.

1. Update Tomcat Port in Server.xml

You can find the server.xml file under {Tomcat server folder}\conf\. Search for the below entry. The default entry uses the port 8080.

[code lang=”xml”]
<!– Define a non-SSL HTTP/1.1 Connector on port 8180 –>
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
[/code]

Change to new port number as follows.

[code lang=”xml”]
<!– Define a non-SSL HTTP/1.1 Connector on port 8180 –>
<Connector port="8081" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
[/code]

Once you re-start the server, it runs on the port 8181.

2. Update Tomcat Port in Eclipse

If you are running the tomcat server embeded with Eclipse IDE, then it is very easy to update the port number without editing the configuration files. You can double click on the server and edit the port number. After the change save the file. It is done.

tomcat-server-1

tomcat-server-2

Filed Under: Java Tagged With: Apache Tomcat

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Us

  • Facebook
  • Pinterest

As a participant in the Amazon Services LLC Associates Program, this site may earn from qualifying purchases. We may also earn commissions on purchases from other retail websites.

JavaBeat

FEATURED TUTORIALS

Answered: Using Java to Convert Int to String

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Copyright © by JavaBeat · All rights reserved