zmou-d
zmou-d

Reputation: 914

IntelliJ IDEA - Address localhost:1099 is already in use

I try to launch a web application with IntelliJ IDEA, but I get an error: localhost:1099 already in use.

port 1099 is already in use

I checked the port 1099 with lsof -i:1099 and many other relative commands, so I'm pretty sure the port 1099 is free.

This is my running configuration:

configs

I've also changed the JMX port to 6666 & 6667 & 6668... and it doesn't work, so I think it's not really related to the port itself.

I am so confused... did anyone else have this problem?

Any help is appreciated

Upvotes: 61

Views: 108321

Answers (12)

Wiki
Wiki

Reputation: 141

Even if we don't have admin access, use the below command to kill the port

➜ lsof -i :9096

COMMAND   PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME java    49455 test  171u  IPv6 0xccea5af095aca7d1      0t0  TCP
*:9096 (LISTEN)

kill 49455 (PID)

Upvotes: 0

womd
womd

Reputation: 3453

in my case

  • netstat command did not show anything, on that port
  • tcpview did not show anything.

the solution was to:

net stop winnat

net start winnat

as David posted at: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360006880600-IDEA-Start-Failed-Address-already-in-use

Upvotes: 15

Monu Rohilla
Monu Rohilla

Reputation: 665

If you are a window user then Open cmd as an administrator and use netstat -aon | find "1099" and then you will get result like this

  TCP    0.0.0.0:1099           0.0.0.0:0              LISTENING       9960
  TCP    [::]:1099              [::]:0                 LISTENING       9960

In my case the LISTENING port is 9960 this may be different in your case. so use taskkill /F /PID 9960

for details look at this enter image description here

Upvotes: 6

Alexander Borisov
Alexander Borisov

Reputation: 1199

Solution for those who can not find the process with `netstat -aon` command.

Some ports might be reserved by default in various networks. Therefore, if you can not find a :1099 port with netstat -aon command you need to check your reserved ports first.

netsh interface ipv4 show excludedportrange protocol=tcp

Port 1099 might show up as a reserved one in the list. However, it was not the case for me. I decided to try to make an exception for it anyway. It worked!

Follow these steps:

  1. Make sure to copy this text to your notepad, because you will lose internet connection for a moment.

  2. Open your CMD as an administrator.

  3. Write these commands one by one in order to stop your network:

    net stop winnat

    net stop LanmanWorkstation

    net stop WlanSvc

    net stop WwanSvc

  4. Exclude port 1099 from a reserved list:

netsh int ipv4 add excludedportrange protocol=tcp startport=1099 numberofports=4
  1. Start your network again:

    net start winnat

    net start LanmanWorkstation

    net start WlanSvc

    net start WwanSvc

  2. Done.

Temporary solution.

Simply changing JMX port to 1599 inside of the IntelliJ IDEA also solved this issue for me.

Upvotes: 36

Xian Sheng.H
Xian Sheng.H

Reputation: 359

if you are using Mac,and the port is totally free ,you can check your hosts,and add 127.0.0.1 localhost if it's not exist

Upvotes: 2

Dilip
Dilip

Reputation: 31

Thank you @ Dulith De Costa, Perfect Answer

netstat -aon | find "1099"

taskkill /F /PID "Process ID"

Now you can start your server.

Upvotes: 1

Du-Lacoste
Du-Lacoste

Reputation: 12777

Since it is easy to tackle with Command Prompt. You can do the following. I assume you work on Windows.

Open the CMD and type following.

netstat -aon | find "1099"

If a process uses above port, it should return something output like this.

TCP    xxx.xx.xx.xx:1099      xx.xx.xx.xxx:443      ESTABLISHED     2222

The last column value (2222) is referred to the Process ID (PID).

Just KILL it as follows.

taskkill /F /PID 2222

Now you can start your server.

Upvotes: 70

Yuresh Karunanayake
Yuresh Karunanayake

Reputation: 567

1.Close Your Other running projects in same or other IDEs -or- 2.Close all java related running applications from Task Manager (java(TM) Platform SE binary)

The port:1099 is used by java.exe (http://www.nirsoft.net/utils/cports.html use the portable app in this link to view port usage (which program use that port))

I also faced it . i had opened both intellij and netbeans. when i run my project in Intellij , above problem raised. it solved after closed netbean and run my intellij project.

Upvotes: 1

GEVOR ASATRYAN
GEVOR ASATRYAN

Reputation: 79

cmd command netstat-ano: cmd command tasklist:

  1. The first step, the command prompt, execute the command:

    netstat –ano
    

    Visible, port 1099 process PID is 6072.

  2. The second step, the command prompt, execute the command:

    tasklist
    
  3. The third step, the task manager, the termination of the process java.exe

    We will see the opening of the 2 java.exe, to end it all.

  4. The fourth step, restart tomcat, can be started

Upvotes: 7

Celly
Celly

Reputation: 325

Had the same issue today. Try using

ps -C java -o pid

in the terminal. THis will give you a list of running programs. For me i had an existing java running in the background so i used

pkill java

Then just restart you intelliJ.

Upvotes: 4

zmou-d
zmou-d

Reputation: 914

Actually it may caused by my hosts file,

I guess it's about the configurations about localhost :I deleted the configuration about localhost of ipv6 by accident,

so the solution is that I add a line ::1 localhost into hosts file and then everything work well!

Upvotes: 5

Dias Neto
Dias Neto

Reputation: 43

Try to kill all java tasks from O.S manager, maybe there is some ghost process running.

Upvotes: 3

Related Questions