1/10/2007

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:

logs/catalina.2007-01-09.log:
...
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
nt.java:297)
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(PoolTcpEndpo
int.java:312)
at org.apache.coyote.http11.Http11BaseProtocol.start(Http11BaseProtocol.
java:150)
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
59)
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

8 comments:

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

@2d

Anonymous said...

Thanks a lot that helped!

Anonymous said...

thanks alot :) that helped !

Abhishek Ramkumar 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 ???

Steve Smith 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

حسام داود said...

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