简体   繁体   中英

how to stop all ports in apache tomcat

While developing a web application using Apache Tomacat and Eclipse frequently I get this message

Several ports (7354, 6544, 9999) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).

I know that this ports are in use, but I don't if I stop all those servers also why get the same message. My question is - Is there any way to stop all ports at once in using Eclipse or Windows 7 ?

you can use the lsof in combination with awk . do the following:

lsof -i :<portnumber> | awk '{print "kill -9 "$2}' | sh

if you want to know only the processId from the port, use:

lsof -i :<portnumber> | awk '{print $2}'

btw: i have this problem sometimes too. If you're using eclipse check in the debug view if there is still a thread of the tomcat running. if so, stop them :) Otherwise restart eclipse.

Have you tried the following?

ps -ef | grep <port number>
kill -9 <process id>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM