score:165

Accepted answer

yes you have another process bound to the same port.

tcpview (windows only) from windows sysinternals is my favorite app whenever i have a jvm_bind error. it shows which processes are listening on which port. it also provides a convenient context menu to either kill the process or close the connection that is getting in the way.

score:0

i faced similar issue in eclipse when two consoles were opened when i started the server program first and then the client program. i used to stop the program in the single console thinking that it had closed the server, but it had only closed the client and not the server. i found running java processes in my task manager. this problem was solved by closing both server and client programs from their individual consoles(eclipse shows console of latest active program). so when i started the server program again, the port was again open to be captured.

score:0

your port must be busy in some other process. so you can download tcpview on https://technet.microsoft.com/en-us/sysinternals/bb897437 and kill the process for used port.

if you don't know your port, double click on the server that is not starting and click on open server properties page and click on glassfish from left column. you will find the ports here.

score:0

(1) check the port is in use or not, kill that process

$ lsof -i:[port]

(2) another reason is the port is used by ipv6, solution:

edit /etc/sysctl.conf

add this to the file

net.ipv6.conf.all.disable_ipv6 = 1

then make it effect

$ sudo sysctl -p /etc/sysctl.conf

or just reboot

score:0

it means some other process is already using the port. in case if this port is being used by some other critical applications and you don't want to close that application, the better way is to choose any other port which is free to use.

configure your application to use any other port which is free and you will see your application working.

score:0

you can close every java process and start again your app:

taskkill /f /im java.exe

start your app again...

score:0

i actually just used the terminate button in console tab. it's a small red box. hope that hepls.

score:2

the port is already being used by some other process as @diego pino said u can use lsof on unix to locate the process and kill the respective one, if you are on windows use netstat -ano to get all the pids of the process and the ports that everyone acquires. search for your intended port and kill.

to be very easy just restart your machine , if thats possible :)

score:2

restart the pc once, i think it will work. it started working in my case. one more thing can be done go to task manager and end the process.

screenshot for the reference.

score:2

in my case tomcat was running in a background. i've installed it as a external servlet while using eclipse. with a spring boot in intellij it has it own server but cannot start while it's already occupied.
in my case tomcat starts automatically i turn on my os, that is why i need to shut down him manualy:

$ sudo service tomcat stop

of course "tomcat" depends what version of tomcat you are using.
hope it might help to someone.

score:3

yes, as guido simone said it because another process listening to the same port.if you are in ubuntu you can simply kill that process giving command sudo kill $(sudo lsof -t -i:[port number])

ex: sudo kill $(sudo lsof -t -i:8080)

but once it didn't work for me. i gave the command

$ lsof -i:[port] 

and it shows nothing.

i checked my docker containers using command docker ps -a but non of them alive.all containers has stopped (but i remember ,i stopped one container which was used same port few minutes ago.).to make sure that docker is not the reason,i stop whole docker process using command sudo service docker stop and try again. surprisingly eclipse didn't show the error at that time .it run my program perfectly.

hope my experience will help some one.

score:4

this bindexception would come when another process is already running in the specified port(8080).

you can use anyone of the following approach.

  1. change the server port: if you are using tomcat server and intellij ide, you can configure the server port by configuring the tomcat server

    enter image description here

or

  • go to tomcat>conf folder
  • edit server.xml
  • search "connector port"
  • replace "8080" by your port number
  • restart tomcat server.
  1. kill the existing running process in that port and start the server.

for linux/mac

sudo kill -9 $(sudo lsof -t -i:8080)

for windows

netstat -ano | findstr :8080
taskkill /pid typeyourpidhere /f 

note: (/f forcefully terminates the process)

score:5

in windows cmd line, find out the process id that hold a connection on the bind port by entering following command:

c:> netstat -a -o

-a show all connections

-o show process identifier

and then terminate the process.

score:5

you need to close your port if you are a linux user then type

fuser -k 8080/tcp

score:9

you have another process running on the same port.

you could try killing one of the java.exe services running in your task manager - ps make sure you dont kill eclipse since that is listed as java.exe as well. if nothing else works, restarting your machine will fix it anyhow. it looks like youre not shutting down a socket from a previous test. hope this helps.

score:9

for those who are looking for the simplest of the answers (as that is what we usually miss), just stop your running project and start it again. most of the time what we do is we forget to stop the project we ran earlier and when we re-run the project it shows such an issue.

i am also attaching a photo to make it clearer (i use 'spring tool suite'). so what you need to do is either click the button on the extreme right, if you want to relaunch the same project or first click on the button which is 2nd from the right to stop your project and then the button on the extreme left to run your project. i hope this will solve the issue of few of the newer programmers. :)

enter image description here

score:20

for windows :

  1. find the process id

    netstat -nao | find "8080"

it will show you the process id as a number.

example:

tcp    0.0.0.0:8080           0.0.0.0:0              listening       18856

here 18856 is the process id

  1. kill that process

    taskkill /pid 18856 /f

output : success: the process with pid 18856 has been terminated.

here using taskkill you are killing the process id:18856

for linux/mac:

sudo kill -9 $(sudo lsof -t -i:8080)

here you find the process by port 8080 using sudo lsof -t -i:8080 and killing it by sudo kill command

score:33

(windows only)

to kill a process you first need to find the process id (pid)

by running the command :

netstat -ano | findstr :yourportnumber

as shown in picture below

you will get your process id (pid), now to kill the same process run this command:

taskkill /pid yourid /f

enter image description here

score:40

in mac:

kill process terminal: kill <pid>

find pid: terminal: lsof -i:<port>

from diego pino answer

score:44

in ubuntu/unix we can resolve this problem in 2 steps as described below.

  1. type netstat -plten |grep java

    this will give an output similar to:

    tcp   0   0 0.0.0.0:8080   0.0.0.0:*  listen   1001  76084  9488/java       
    

    here 8080 is the port number at which the java process is listening and 9488 is its process id (pid).

  2. in order to free the occupied port, we have to kill this process using the kill command.

    kill -9 9488
    

    9488 is the process id from earlier. we use -9 to force stop the process.

your port should now be free and you can restart the server.

score:137

in windows

netstat -ano

will list all the protocols, ports and processes listening . use

taskkill -pid "proces to kill" /f

to kill the process listening to the port. e.g

 taskkill -pid 431 /f

score:239

if you know what port the process is running you can type: lsof -i:<port>.

for instance, lsof -i:8080, to list the process (pid) running on port 8080.

then kill the process with kill <pid>


Related Query

More Query from same tag