32

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.

INDRAJITH EKANAYAKE
  • 3,894
  • 11
  • 41
  • 63

2 Answers2

91

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.

Romil Patel
  • 12,879
  • 7
  • 47
  • 76
9

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.

JackU
  • 1,406
  • 3
  • 15
  • 43
  • Hello @JackU, Can you please let me know which option doesn't work for you – Romil Patel Jul 05 '19 at 04:11
  • 1
    @PatelRomil Hi, `Option 1`: Wasn't possible to kill process from IDE in my circumstance. `Option 2`: Also not as possible as external applications were using the port. `Option 3`: Getting an error when using CMD `findstr is not recognized as an internal pr external command`. I realise that your `Option 3` and my answer are very similar apart from the way to find the `PID`, which I was unable to do following your answer. I have no doubt that your answer will be the solution most of the time. Options based on the order before the edit. – JackU Jul 05 '19 at 05:51