In Windows and linux, killing tomcat processes can also solve the problem of occupying other ports.

Source: Internet
Author: User

In Windows and linux, killing tomcat processes can also solve the problem of occupying other ports.

1. application scenarios

In Windows or linux, when we start a tomcat server, we often find that port 8080 is occupied, and we do not know how to stop the tomcat server.

2. Killing processes in the window environment

1. First, find the PID of the process that occupies port 8080 (Tomcat is port 8080 by default. If you have modified the tomcat listening port, enter your tomcat port number.)

netstat -ano | findstr 8080

The last column of the command output indicates the number of processes that occupy port 8080, which is assumed to be 9572.

 

2. kill this process

taskkill /f /pid 9572

 

In this way, port 8080 is released.

3. Shut down the tomcat process in linux

1. Check whether tomcat is running.

ps -ef |grep tomcat 

If tomcat is running, the following results are displayed:

sun 5144 1 0 10:21 pts/1 00:00:06 /java/jdk/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Djava.endorsed.dirs=/java/tomcat/common/endorsed -classpath :/java/tomcat/bin/bootstrap.jar:/java/tomcat/bin/commons-logging-api.jar-Dcatalina.base=/java/tomcat -Dcatalina.home=/java/tomcat -Djava.io.tmpdir=/java/tomcat/temp org.apache.catalina.startup.Bootstrap start

From the above output, we can know that the process number executed by tomcat is 5144.

2. Killing Processes

Run the following command:

pid = 5144 kill -9 5144 

You can completely kill tomcat.

4. Exceptions

When I start IDEA tomcat again, the following error is reported.

Connected to the target VM, address: '2017. 0.0.1: 50363 ', transport: 'socket' error: the proxy throws an exception error: java. rmi. server. exportException: Port already in use: 1099; nested exception is: java.net. bindException: Address already in use: JVM_BindDisconnected from the target VM, address: '2017. 0.0.1: 50363 ', transport: 'socket'

The main cause of the error is that port 1099 is occupied and we need to kill the process.

Run the following command:

netstat -ano | findstr 1099

I learned the process number: 9992.

Kill process 9992

taskkill /f /pid 9992

You can start it normally.

  Thank you: Thank you for reading this article!

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.