이클립스에서 JSP/Servlet 실행시 아래와 같은 에러가 발생하는 경우가 있다. 내용은 톰캣이 사용하는 포트가 있는데(8005, 8181, 8009) 그 포트를 이미 다른 곳에서 사용하고 있다는 뜻이다.


Several ports (8005, 8181, 8009) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).


이럴 경우는 netstat 명령어를 이용하여 위의 포트의 Process ID(PID)를 알아내서 해당 Process를 kill 시켜 버린 후 다시 이클립스로 해당 프로젝트를 실행하면 정상적으로 구동이 된다.


netstat -anop tcp

 

활성 연결


  프로토콜  로컬 주소              외부 주소              상태            PID

  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       948

  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4

  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING       3596

  TCP    0.0.0.0:5357           0.0.0.0:0              LISTENING       4

  TCP    0.0.0.0:7680           0.0.0.0:0              LISTENING       10260

  TCP    0.0.0.0:8009           0.0.0.0:0              LISTENING       8604

  TCP    0.0.0.0:8181           0.0.0.0:0              LISTENING       8604

  TCP    0.0.0.0:xxxx          0.0.0.0:0              LISTENING       644

  TCP    0.0.0.0:xxxx          0.0.0.0:0              LISTENING       1412

  TCP    0.0.0.0:xxxx          0.0.0.0:0              LISTENING       1296

  TCP    0.0.0.0:xxxx          0.0.0.0:0              LISTENING       2344

  TCP    0.0.0.0:xxxx          0.0.0.0:0              LISTENING       2096

  TCP    0.0.0.0:xxxx          0.0.0.0:0              LISTENING       716

  TCP    0.0.0.0:xxxx          0.0.0.0:0              LISTENING       724

  TCP    0.0.0.0:xxxx          0.0.0.0:0              LISTENING       4

  TCP    127.0.0.1:1235         0.0.0.0:0              LISTENING       3916

  TCP    127.0.0.1:8005         0.0.0.0:0              LISTENING       8604

  TCP    192.168.xxx.xxx:139    0.0.0.0:0              LISTENING       4

  TCP    192.168.xxx.xxx:49651  xxx.xxx.xxx.xxx:443    ESTABLISHED     11008

  TCP    192.168.xxx.xxx:50782  xxx.xxx.xx.x:80        TIME_WAIT       0

  TCP    192.168.xxx.xxx:50837  xxx.xxx.xx.x:80        TIME_WAIT       0

  TCP    192.168.xxx.xxx:50838  xxx.xxx.xx.x:80        TIME_WAIT       0

  TCP    192.168.xxx.xxx:50839  xxx.xxx.xx.x:80        TIME_WAIT       0

... 중 략 ...


이 명령어에서 출력된 내용중 8005, 8181, 8009 포트에 대한 PID가 8604임을 확인할수 있고 해당 Process를 다음과 같이 죽이면 된다.

DOS(커맨더) 창에서 아래 명령어로 해당 Process를 죽이면 된다.


taskkill -f /pid 8604



+ Recent posts