How to run two tomcat servers on the same computer at the same time

Source: Internet
Author: User

How to run two tomcat servers on the same computer at the same time

For projects created some time ago, the client needs to access my server during development because it serves as a server for the mobile client.

The problem is that I am also developing and have not joined the hot deployment, which will inevitably cause frequent server restart, which will also have a certain impact on client development.

Now we need to run two tomcat servers, one for development and the other for the client. So the question is, how can I run two tomcat servers on the same computer at the same time?

If nothing is configured, run two tomcat servers:


An error occurred while prompting that port 8005 is in use. Tomcat uses port 8005 by default to listen for requests to disable tomcat.

Therefore, the port number cannot be repeated. You can modify the conf/server. xml file of tomcat to change the port number.

This port is defined in the Server label. port represents the port number, and shutdown represents the Server's request command. For example, we change it to 8006.

<Server port="8006" shutdown="SHUTDOWN">

For a tomcat server that has been enabled, run the telnet localhost 8005 command in cmd to connect to the server. Then run the "SHUTDOWN" command to shut down the server.

Modifying this port is not enough. You must have already thought of it, because tomcat will also use port 8080 by default to listen to user requests.

Find 8080 in server. xml, and change it to 8090 in about 69 lines:

    <Connector port="8090" protocol="HTTP/1.1"                connectionTimeout="20000"                redirectPort="8443" >

Looking down a few lines, we will see a port number of 8009. What is this? Regardless of it, try to see if two tomcat servers can be enabled at the same time:


Hey, you have succeeded? At this time, you can see the tomcat interface through localhost: 8080 or localhost: 8090.

But if you look at it carefully, you will find a few words at the bottom.

Information: Port busy 8009 java.net. BindException: Address already in use: JVM_Bind severe: Can't find free port 8009 8009

Is there any impression on this port? As you can see in server. xml, this is the second connector that comes with tomcat. It listens to port 8009 and is responsible for establishing connections with other HTTP servers. This connector is used when Tomcat is integrated with other HTTP servers. I know its usefulness. In fact, we generally cannot use this port in our project. It doesn't matter if we don't change this port ~



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.