Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Several ports (8005, 8080, 8009) required by Tomcat Server at localhost are already in use

People also ask

What is Tomcat 8005 port?

Tomcat listens on TCP port 8005 to accept shutdown requests. By connecting to this port and sending the SHUTDOWN command, all applications within Tomcat are halted.

How do you fix the start of Tomcat failed the server port 8080 is already in use?

Change your Tomcat port address to 8084 and Shut Down Port to 8025 . This will resolve your problem.


You've another instance of Tomcat already running. You can confirm this by going to http://localhost:8080 in your webbrowser and check if you get the Tomcat default home page or a Tomcat-specific 404 error page. Both are equally valid evidence that Tomcat runs fine; if it didn't, then you would have gotten a browser specific HTTP connection timeout error message.

You need to shutdown it. Go to /bin subfolder of the Tomcat installation folder and execute the shutdown.bat (Windows) or shutdown.sh (Unix) script. If in vain, close Eclipse and then open the task manager and kill all java and/or javaw processes.

Or if you actually installed it as a Windows service for some reason (this is namely intented for production and is unhelpful when you're just developing), open the services manager (Start > Run > services.msc) and stop the Tomcat service. If necessary, uninstall the Windows service altogether. For development, just the ZIP file is sufficient.

Or if your actual intent is to run two instances of Tomcat simultaneously, then you have to configure the second instance to listen on different ports. Consult the Tomcat documentation for more detail.


kill $(ps -aef | grep java | grep apache | awk '{print $2}')
  • no need to restart Eclipse
  • if you get the above error, just enter this line in terminal
  • again start the tomcat in Eclipse.
  • works only in Linux based system ( Ubuntu ..etc )

If you are running on windows try this in the command line prompt:

netstat -ano

This will show all ports in use and the process id PID # of the process that is using that port. Then Ctrl+Alt+Del and open Task Manager to see which process is that.

You can then choose either to close/stop it or configure your server to use another port. To check if the new choosen port (let's say 8010) is available do this:

netstat -ano | grep 8010

If it does not return any lines then you are fine.

To change the port go to the Server view, open server.xml and change the port there. Mine has this entry:

Connector port="8010" protocol="AJP/1.3" redirectPort="8443"

If you are on mac environment, here is what I did.

Find the process id running on this port from terminal, eg, 8080:

lsof -i :8080

and kill it:

kill -9 <PID>  

Example:

You may see following result:

MacSys:bin krunal.$ lsof -i :8080

COMMAND   PID     USER   FD   TYPE     DEVICE  SIZE/OFF   NODE  NAME
java     21347   krunal  52u  IPv6      XXX      0t0      TCP  *:http-xxx (LISTEN)

and kill it: (kill -9 21347)