8080 port already taken issue when trying to redeploy project from Spring Tool Suite IDE

前端 未结 22 2513
梦毁少年i
梦毁少年i 2020-12-07 10:49

I have strange thing when I try to modify Spring project inside my Spring Tool Suite. On the first load (deploy) everything is fine, application compiles and runs on localho

相关标签:
22条回答
  • 2020-12-07 10:55

    On Linux Machine, save the bash script and execute it. If you want to free port 8080, Input 8080 when prompted

    echo "Enter port number to be closed :: "
    read port
    sudo kill $(sudo lsof -t -i:$port)
    
    0 讨论(0)
  • 2020-12-07 10:55

    There are some processes left in the background on that port, several reasons can cause this problem, but you can solve easily if you end process which is related to 8080 or Spring.

    If you are using Linux there is steps how to end process:

    1. Open terminal and type command "htop"
    2. press key F3(it will allow you to search)
    3. Type "8080" if there was no result on 8080 after that try "spring"
    4. Then Press F9(KILL) And press "9"(SIGKILL)

    this will kill process which is left on 8080 port and let you run application.

    0 讨论(0)
  • 2020-12-07 10:56

    This is a typical startup failure due to the embedded servlet container’s port being in use.

    Your embedded tomcat container failed to start because Port 8080 was already in use.

    Just Identify and stop the process that's listening on port 8080 or configure (in you application.properties file )this application to listen on another port.

    0 讨论(0)
  • 2020-12-07 10:58

    hi creating a simple line in application.properties as SERVER_PORT=8090 solved the issue.

    0 讨论(0)
  • 2020-12-07 11:01

    There are two ways to resolve this issue.Try option 1 first, if it doesn't work try option 2, and your problem is solved.

    1) On the top right corner of your console, there is a red button, to stop the spring boot application which is already running on this port just click on the red button to terminate.

    2) If the red button is not activated you need to right click on the console and select terminate/disconnect all. Hope this helps.

    Bonus tip:- If you want to run your server on a different port of your choice, create a file named application.properties in resource folder of your maven project and write server.port=3000 to run your application on port 3000

    0 讨论(0)
  • 2020-12-07 11:02

    The reason is one servlet container is already running on port 8080 and you are trying to run another one on port 8080.

      1. Check what processes are running at available ports.

        • For Windows :

        • netstat -ao |find /i "listening" Image01

        OR

        • netstat -ano | find "8080" (Note: 8080 is port fail to start) Image02
      1. Now try to reLaunch or stop your application.

        • To relaunch: you can press this button

      Image03

      • To stop in windows:

      Taskkill /F /IM 6592 Note: Mention correct Process Id

      Image04

      right click on the console and select terminate/disconnect all

      • Go to Task Manager and end Java(tm) platform se binary

      click here to view image

      What is java(tm) platform se binary(Search in google

    Another option is :

    Go to application.properties file set server.port=0. This will cause Spring Boot to use a random free port every time it starts.

    0 讨论(0)
提交回复
热议问题