skip to Main Content

I am trying to run a Hello World application with Spring Boot on IntelliJ IDEA. I have the following code:

package com.example.springbootexample;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringBootExampleApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootExampleApplication.class, args);
    }

}

After building and running the code I get the following error message:

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

Description:

Web server failed to start. Port 8080 was already in use.

Action:

Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.


Process finished with exit code 1

Trying to identify the process that uses the port 8080 I run lsof -i :8080, but I get a blank output. What could the problem be?

2

Answers


  1. Probably you already launched the application before? Check in one of the IntelliJ’s Services tab (I assume it’s IntelliJ you’re using) if it displays the logging output of the same application already launched.

    If it’s blocking, you could either change the proprty server port in your application.properties file:

    server.port=8089

    Then you can start again and it should work

    Login or Signup to reply.
  2. There are following things you can do here:

    1. If you are running your code with command like mvn spring-boot:run then go to terminal section and close the running by ctrl+center image description here

    2. Change your port in application.properties file with command server.port=9090enter image description here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search