82

I am unable to start GlassFish, because it keeps showing this error message:

SEVERE: Shutting down v3 due to startup exception : No free port within range: 8080=com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectorHandler@ed7d1

How can I find what applications are using what ports on Windows Vista? I have tried using nmap zenmap using the following target:

http://127.0.0.1:8080

But all I get is this:

Starting Nmap 5.51 ( http://nmap.org ) at 2011-08-05 12:05 Central Daylight Time

NSE: Loaded 57 scripts for scanning.

Read data files from: C:\Program Files\Nmap
Nmap done: 0 IP addresses (0 hosts up) scanned in 4.55 seconds
           Raw packets sent: 0 (0B) | Rcvd: 0 (0B)
WARNING: No targets were specified, so 0 hosts scanned.
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Flethuseo
  • 5,969
  • 11
  • 47
  • 71
  • possible duplicate of [How to check port 8080 in Windows Vista command prompt?](http://stackoverflow.com/questions/6606612/how-to-check-port-8080-in-windows-vista-command-prompt) – Matt Ball Aug 05 '11 at 17:12
  • This saved my day, yet it belongs to superuser.com, I wish there was a way to move questions betwen stackexchange sites – SparK Sep 29 '14 at 21:04
  • While developing web services in VS 2017 in C#, this question/answer stopped me from rebooting my computer every 2 hours ... while it is not directly relevant to programming, it is indirectly extremely helpful to all of us developing sockets. – Miguel Mateo Oct 01 '17 at 02:40
  • So you are looking which application is using port 8080? First, enter this command in cmd ..... netstat -ano | findstr :8080 this or similar you will see TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4492 now you know the id of application which using port 8080 then find that app using id type in this code with your id, (in my case it 4492) tasklist | findstr 4492 and here you go. Tomcat9.exe 4492 Services 0 77.988 K – Konstantin F Jun 03 '19 at 09:37

4 Answers4

120

How about netstat?

http://support.microsoft.com/kb/907980

The command is netstat -anob.

(Make sure you run command as admin)

I get:

C:\Windows\system32>netstat -anob

Active Connections

     Proto  Local Address          Foreign Address        State           PID
  TCP           0.0.0.0:80                0.0.0.0:0                LISTENING         4
 Can not obtain ownership information

  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       692
  RpcSs
 [svchost.exe]

  TCP    0.0.0.0:443            0.0.0.0:0              LISTENING       7540
 [Skype.exe]

  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
 Can not obtain ownership information
  TCP    0.0.0.0:623            0.0.0.0:0              LISTENING       564
 [LMS.exe]

  TCP    0.0.0.0:912            0.0.0.0:0              LISTENING       4480
 [vmware-authd.exe]

And If you want to check for the particular port, command to use is: netstat -aon | findstr 8080 from the same path

Kusum
  • 241
  • 5
  • 20
Peter Kellner
  • 14,748
  • 25
  • 102
  • 188
  • 28
    did netstat -anob | findstr "8080", it gave me the task id, It would be nice though to know, which application is using it from the PID, is there a command to do this? btw: not through the task manager, I hate having to search through that list – Flethuseo Aug 05 '11 at 18:06
  • 8
    You can use `tasklist` command to see list of all running processes with their PID. – Amir Oveisi Sep 01 '13 at 04:23
  • 3
    question marked off topic but this answer saved my day, i found the cuprit using 8099! Thanks. – UnDiUdin Mar 20 '14 at 07:40
  • 2
    This worked for me but after using `taskkill /pid 8516`, I got `ERROR: The process "8516" not found.` Turns out if a child process is running, Windows will keep the socket around. Killing the child process freed the socket. http://serverfault.com/questions/181015/how-do-you-free-up-a-port-being-held-open-by-dead-process – jtpereyda Jul 06 '15 at 21:08
  • In my case Oracle TNS Listener was the culprit:tasklist | findstr "5676" TNSLSNR.EXE 5676 Services 0 5,140 K – nicordesigns Jan 21 '19 at 23:09
10

To see which ports are available on your machine run:

C:>  netstat -an |find /i "listening"
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Carlos Quintanilla
  • 12,937
  • 3
  • 22
  • 25
7

It may be possible that there is no other application running. It is possible that the socket wasn't cleanly shutdown from a previous session in which case you may have to wait for a while before the TIME_WAIT expires on that socket. Unfortunately, you won't be able to use the port till that socket expires. If you can start your server after waiting for a while (a few minutes) then the problem is not due to some other application running on port 8080.

ritesh
  • 982
  • 5
  • 5
3

On the command prompt, do:

netstat -nb
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jontsai
  • 682
  • 1
  • 6
  • 13