How Do I Fix Web Server Failed to Start Port 8080 Was Already in Use in Spring Boot?


Larry Thompson

Are you encountering the dreaded “Web Server Failed to Start: Port 8080 Was Already in Use” error while working with Spring Boot? Don’t worry, you’re not alone!

This common issue occurs when the port you’re trying to use for your Spring Boot application is already occupied by another process on your machine. In this tutorial, we’ll explore various solutions to fix this problem and get your Spring Boot application up and running smoothly.

Understanding the Error

Before we dive into the solutions, let’s understand why this error occurs. When you start a Spring Boot application, it attempts to bind to a specific port, typically 8080 by default. If another process on your machine is already using that port, such as another web server or an application running in the background, Spring Boot won’t be able to start and throws the “Port 8080 Was Already in Use” error.


1. Identify and Stop the Conflicting Process

The first step is to identify the process that is currently using port 8080. There are multiple ways to do this:

  • Command Line: Open your terminal or command prompt and run the following command:
  • netstat -ano | findstr :8080

    This command will display all active connections on port 8080 along with their corresponding Process ID (PID).

  • Task Manager (Windows): Press Ctrl + Shift + Esc to open Task Manager. In Task Manager, go to the “Processes” tab and click on “View” → “Select Columns”. Check “PID (Process Identifier)” and click “OK”.

    Now, find the process with the matching PID in the “PID” column.

  • Activity Monitor (Mac): Open Activity Monitor by pressing Command + Space and searching for “Activity Monitor”. In Activity Monitor, go to the “Network” tab and enter “8080” in the search bar. This will display all processes using port 8080.

Once you’ve identified the conflicting process, you can stop it or change its port to resolve the issue.

2. Change Spring Boot Application Port

If stopping the conflicting process is not an option, you can change the default port used by your Spring Boot application. To do this, open your or application.yml file (usually located in the src/main/resources directory) and add or modify the following line:


In this example, we’ve changed the port to 8090. Save the file and restart your Spring Boot application. It should now start successfully on the new port without any conflicts.

3. Use a Different Port for Conflicting Process

If you don’t want to change your Spring Boot application’s port, you can configure the conflicting process to use a different port instead. The steps for doing this depend on the specific process/application that’s causing the conflict:

  • XAMPP/WAMP: If you’re using XAMPP or WAMP as your local web server, open their respective control panels and navigate to Apache settings. Look for a configuration file called “httpd.conf” and search for “Listen 80”.

    Change it to a different port, e.g., “Listen 8081”. Save the file and restart the server.

  • Tomcat: If you’re using Tomcat, open the “server.xml” file located in the “conf” directory of your Tomcat installation. Search for a line that looks like this:
    <Connector port="8080" protocol="HTTP/1.1" .. />

    Change the port to something else, e.,

    <Connector port="8081" protocol="HTTP/1. />

    Save the file and restart Tomcat.

  • Other Applications: For other applications or processes, refer to their documentation or configuration files to find instructions on changing the default port.

After making these changes, restart both the conflicting process and your Spring Boot application. They should now coexist peacefully without any port conflicts.

In Conclusion

The “Web Server Failed to Start: Port 8080 Was Already in Use” error can be frustrating, but with the solutions provided in this tutorial, you should be able to resolve it quickly. Whether you choose to stop the conflicting process, change your Spring Boot application’s port, or configure the conflicting process to use a different port, now you have multiple options at your disposal. Happy coding!

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy