How to run Tomcat on a different port number

Tomcat web server by default runs on port number 8080, which is also the default port number used by some other popular servers like JBoss, JavaEE SDK, Sun Java System Application Server. When this port number is already used by another process, you will get the following error:

INFO: Starting Servlet Engine: Apache Tomcat/5.5.20
Jan 11, 2007 9:36:12 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jan 11, 2007 9:36:13 AM org.apache.coyote.http11.Http11BaseProtocol start
SEVERE: Error starting endpoint
java.net.BindException: Address already in use: JVM_Bind:8080
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoi
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(PoolTcpEndpo
at org.apache.coyote.http11.Http11BaseProtocol.start(Http11BaseProtocol.
at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:75)

at org.apache.catalina.connector.Connector.start(Connector.java:1089)
at org.apache.catalina.core.StandardService.start(StandardService.java:4
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
To use a different port number, back up and edit the port attribute value of Connector element in $CATALINA_HOME/conf/server.xml:
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8081" maxHttpHeaderSize="8192"
Restart Tomcat ($CATALINA_HOME/bin/startup.sh on Unix or %CATALINA_HOME%\bin\startup.bat on Windows), and check server status at URL http://localhost:8081


Anonymous said...

Thank you very much for posting this info. Your instructions are right on and saved me time. thank you. -Brian

Anonymous said...

i did
sed s/8080/80/ Jetspeed-2.2.2/conf/server.xml > Jetspeed-2.2.2/conf/server2.xml
mv Jetspeed-2.2.2/conf/server2.xml Jetspeed-2.2.2/conf/server.xml


Anonymous said...

Thanks a lot that helped!

Anonymous said...

thanks alot :) that helped !

Unknown said...

but how to run the tomcat manager with the changed port

bukalemun said...

Thanks, and you can change port number from "Debug Configuration" you can add parameter like port = 8081

Here's a question : Can i debug the project from 2 different eclipse ???

Unknown said...

Great and Useful Article.

Online Java Course

Java Online Training

Java Course Online

J2EE training

online J2EE training

Best Recommended books for Spring framework

Java Interview Questions

Java Training Institutes in Chennai

Java Training in Chennai

J2EE Training in Chennai

java j2ee training institutes in chennai

Unknown said...

شركة تسليك مجاري المطبخ بالرياض
شركة تسليك مجارى الحمام بالرياض
level تسليك المجاري بالرياض
افضل شركة تنظيف بالرياض
تنظيف شقق بالرياض
شركة تنظيف منازل بالرياض
شركة غسيل خزنات بالرياض
افضل شركة مكافحة حشرات بالرياض
رش مبيدات بالرياض
شركة تخزين عفش بالرياض
شركة تنظيف مجالس بالرياض
تنظيف فلل بالرياض
ابى شركة تنظيف بالرياض

eMexoT said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

Internet Of Things training in electronic city