Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Kill Process By PORT Number [duplicate]

I'm using embedded Tomcat server in Spring Tool Suite IDE. My problem is when I run my project there is an error as follows,

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.

There are some similar questions but none of the answers not working for me.

like image 208
INDRAJITH Avatar asked Mar 23 '19 08:03

INDRAJITH


People also ask

What is running on port 8080?

Port number 8080 is usually used for web servers. When a port number is added to the end of the domain name, it drives traffic to the web server.


2 Answers

Solution 1: Kill Process

Run command-line as an Administrator

netstat -ano | findstr :<yourPortNumber>
taskkill /PID <typeyourPIDhere> /F

Solution 2: Change Port

Please Make sure that new port you are going to set for your Application doesn't listen to any other process

Change the port 
server.port=8088 # Server HTTP port.

Solution 3: Another way is to terminate the process (in IDE) and clean and rebuild project.

enter image description here

enter image description here

UPDATE:

For solution 2, Please Make sure that new port you are going to set for your Application doesn't listen to any other process.

How to check Port Status?

Option 1

Run resmon.exe and go to Network -> Listening Port (Also can be viewed on TaskManager) enter image description here


Option 2

PowerShell

Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess

cmd

 C:\> netstat -a -b

(Add -n to stop it trying to resolve hostnames, which will make it a lot faster.)

-a Displays all connections and listening ports.

-b Displays the executable involved in creating each connection or listening port. In some cases, well-known executables host multiple independent components, and in these cases, the sequence of components involved in creating the connection or listening port is displayed. In this case, the executable name is in [] at the bottom, on top is the component it called, and so forth until TCP/IP was reached. Note that this option can be time-consuming and will fail unless you have sufficient permissions.

-n Displays addresses and port numbers in numerical form.

-o Displays the owning process ID associated with each connection.

like image 174
Romil Patel Avatar answered Oct 14 '22 06:10

Romil Patel


I found that the answer by PatelRomil didn't work for me. I found that by running:

netstat -a -o -n

And getting the PID for the port, and then running:

taskkill /F /PID [PID]

Worked for me. Replace [PID] with the value in the table from the previous command.

like image 27
JackU Avatar answered Oct 14 '22 07:10

JackU