How to run 2 tomcat at the same time on a single computer

Source: Internet
Author: User

The project that was done in the previous period, because it is to the mobile phone client server, so the client needs to access my server during the development process.

The problem is that I am also developing, and do not join the hot deployment, it is bound to cause frequent server restarts, which will have a certain impact on client development.

At this point you need to run two Tomcat, one I developed with, one for the client. so the question is, how do you run 2 tomcat at the same time on a single computer?

If nothing is configured, let's run two Tomcat to try:


Error, indicating that our port number 8005 is occupied. Tomcat uses port 8005 by default to listen for requests to close Tomcat

So the port number cannot be duplicated, so we can change it by modifying Tomcat's Conf/server.xml file.

This port is defined in the Server tab, port represents the port number, and shutdown represents the request command to shut down the server, for example, we changed to 8006

<server port= "8006" shutdown= "Shutdown" >

for a Tomcat server that is already turned on, you can connect using the telnet localhost 8005 command under cmd and enter "SHUTDOWN" command to shut down the server.

Modifying this port is not enough, presumably you should have thought of it, because Tomcat boot by default also consumes 8080 ports to listen for user requests.

So look in the server.xml to see 8080, about 69 rows or so, find to change it to 8090:

    <connector port= "8090" protocol= "http/1.1"                connectiontimeout= "20000"                redirectport= "8443" >

Looking down a few lines, we will see a 8009 port number, what is this? Regardless of it, try to open two tomcat at a time first:


Eh, have you already succeeded? The Tomcat interface can be seen at this time through localhost:8080 or localhost:8090

But if you look closely, you'll find a few words at the bottom.

Info: Port busy 8009 java.net.BindException:Address already in Use:jvm_bind critical: Can ' t find free Port 8009 8009

Does this port still impress? Just seen in Server.xml, this is the second connector that Tomcat comes with, it listens on port 8009 and is responsible for establishing connections with other HTTP servers. When you integrate Tomcat with other HTTP servers, you need to use this connector. Know the use of it, in fact, in our project does not use this port, then change the port number is not really a matter ~



How to run 2 tomcat at the same time on a single computer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.