0

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 ?

f_puras
  • 2,521
  • 4
  • 33
  • 38
test ing
  • 13
  • 6
  • take a look at: http://stackoverflow.com/questions/6204003/kill-a-process-by-looking-up-the-port-being-used-by-it-from-a-bat – Mamun Sardar Oct 12 '14 at 11:09
  • possible duplicate of [Several ports (8005, 8080, 8009) required by Tomcat Server at localhost are already in use](http://stackoverflow.com/questions/5064733/several-ports-8005-8080-8009-required-by-tomcat-server-at-localhost-are-alre) – Michael Oct 12 '14 at 14:41

2 Answers2

0

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.

chresse
  • 5,486
  • 3
  • 30
  • 47
-1

Have you tried the following?

ps -ef | grep <port number>
kill -9 <process id>
Robin
  • 8,162
  • 7
  • 56
  • 101