IT

“java.net.BindException : 이미 사용중인 주소 : JVM_Bind”오류를 어떻게 해결합니까?

lottoking 2020. 6. 3. 08:13
반응형

“java.net.BindException : 이미 사용중인 주소 : JVM_Bind”오류를 어떻게 해결합니까?


이클립스 에서이 오류가 발생했습니다.

run:
     [java] Error creating the server socket.
     [java] Oct 04, 2012 5:31:38 PM cascadas.ace.AceFactory bootstrap
     [java] SEVERE: Failed to create world : java.net.BindException: Address already in use: JVM_Bind
     [java] Java Result: -1
BUILD SUCCESSFUL
Total time: 10 seconds

왜 지금 나타 났는지 잘 모르겠지만 몇 시간 전에 제대로 작동했습니다. 컴퓨터를 다시 시작해야합니까? 그것의 바닥에 어떻게 도착합니까? 조언이나 조언을 부탁드립니다.


예, 다른 프로세스가 동일한 포트에 바인딩되어 있습니다.

JVM_BIND 오류가 발생할 때마다 Windows Sysinternals의 TCPView (Windows 만 해당) 가 가장 좋아하는 앱입니다. 어떤 프로세스가 어떤 포트에서 수신 대기 중인지를 보여줍니다. 또한 프로세스를 종료하거나 방해가되는 연결을 닫을 수있는 편리한 컨텍스트 메뉴를 제공합니다.


프로세스가 실행중인 포트를 알고 있으면 다음을 입력하십시오 lsof -i:<port>..

예를 들어, lsof -i:8080포트 8080에서 실행중인 프로세스 (pid)를 나열합니다.

그런 다음 프로세스를 종료하십시오. kill <pid>


창에서

netstat -ano

모든 프로토콜, 포트 및 프로세스 수신을 나열합니다. 사용하다

taskkill -pid "proces to kill" /f

포트를 수신하는 프로세스를 종료합니다. 예 :

 taskkill -pid 431 /f

Mac에서 :

프로세스 종료 터미널 :kill <pid>

pid 찾기 : 터미널 :lsof -i:<port>

Diego Pino의 답변에서


Ubuntu / Unix 에서는 아래 설명 된대로이 문제를 2 단계로 해결할 수 있습니다.

  1. 유형 netstat -plten |grep java

    이것은 다음과 유사한 출력을 제공합니다.

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

    다음 8080은 Java 프로세스가 청취중인 포트 번호 9488이며 프로세스 ID (pid)입니다.

  2. 점유 된 포트를 해제하려면 kill명령을 사용하여이 프로세스를 종료해야합니다 .

    kill -9 9488
    

    9488이전의 프로세스 ID입니다. 우리가 사용 -9하는 프로세스를 강제로 중지.

이제 포트가 사용 가능해야하며 서버를 다시 시작할 수 있습니다.


(Windows 만 해당)

프로세스를 종료하려면 먼저 프로세스 ID (pid)를 찾아야합니다.

명령을 실행하여 :

netstat -ano | findstr :yourPortNumber

아래 그림과 같이

프로세스 ID (PID)를 얻습니다. 이제 동일한 프로세스를 종료하려면 다음 명령을 실행하십시오.

taskkill /pid yourid /f

여기에 이미지 설명을 입력하십시오


동일한 포트에서 다른 프로세스가 실행 중입니다.

작업 관리자에서 실행되는 java.exe 서비스 중 하나를 강제 종료 할 수 있습니다. ps는 java.exe로 나열되어 있기 때문에 Eclipse를 강제 종료하지 않아야합니다. 아무것도 작동하지 않으면 컴퓨터를 다시 시작해도 문제가 해결됩니다. 이전 테스트에서 소켓을 종료하지 않은 것처럼 보입니다. 도움이 되었기를 바랍니다.


Windows CMD 행에서 다음 명령을 입력하여 바인드 포트에서 연결을 보유하는 프로세스 ID를 찾으십시오.

C :> netstat -a -o

-a 모든 연결 표시

-o 프로세스 식별자 표시

그런 다음 프로세스 종료 하십시오.


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. :)

여기에 이미지 설명을 입력하십시오


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.


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 :)


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.

참조 용 스크린 샷


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.


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.


(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


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.


리눅스 사용자라면 포트를 닫아야합니다.

fuser -k 8080/tcp

참고 : https://stackoverflow.com/questions/12737293/how-do-i-resolve-the-java-net-bindexception-address-already-in-use-jvm-bind

반응형