IntelliJ / Spring / Tomcat - Error running 'my_project': Unable to open debugger port (127.0.0.1:50188): java.net.BindException "Address already in use: JVM_Bind"
In this article I would like to show how to solve the problem when we are not able to run a Spring Framework based project in debug mode in IntelliJ IDEA because some port is in use by some process that wasn't stopped correct way (the case mentioned in the article uses Tomcat as server run on Windows).
The article describes situation when IntelliJ IDEA displays:
Error running 'my_project': Unable to open debugger port (127.0.0.1:50188): java.net.BindException "Address already in use: JVM_Bind"
There are 2 solutions:
- Kill process that uses debug port,
- Remove and add Debug / Run Configuration again.
Solutions details
1. Kill process that uses debug port
It is necessary to find PID of the process that wasn't stopped in correct way by IntelliJ and kill it manually from cmd level. As we can see from below screenshot the port taken is 50188 by some process.
Simple steps:
- to find
PIDof process that uses port50188run following command:netstat -ano | findstr :50188 - to kill process with
PID50188run following command:taskkill /PID 6032 /F
Example console output:
After taskkill executiuon we can run our project in debug mode.
2. Remove and add Debug / Run Configuration again
The solution is to remove my_project configuration from Debug / Run Configurations and create new one.
Explanation: sometimes IntelliJ has same problems when we change configutaions of Tomcat that is used by some project.
Below screenshots show how to open Debug / Run Configurations window.