Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- JPA
- java
- springboot
- 클린 코드
- 티스토리챌린지
- 스프링
- Vue.js
- 클린코드
- MySQL
- Gradle
- Codeup
- 파이썬
- Postman
- go
- 객사오
- GitHub
- Spring Boot
- mariadb
- H2 설치
- golang
- 롬복
- spring security
- 코드업
- 오블완
- thymeleaf
- Spring
- Git
- 기초100제
- 알고리즘
- Python
Archives
- Today
- Total
nyximos.log
[Spring] Web server failed to start. Port 8080 was already in use. 해결 방법 본문
Programming/Spring
[Spring] Web server failed to start. Port 8080 was already in use. 해결 방법
nyximos 2022. 2. 4. 00:51윈도우 기준입니다.
Application을 Run하니 이런 에러가 떴다.
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-02-04 00:22:40.284 ERROR 34156 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8080 was already in use.
Action:
Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
Process finished with exit code 1
Web server failed to start. Port 8080 was already in use.
8080 포트를 이미 사용중이라서 웹 서버가 시작하는 것을 실패했다.
🧚♀️ 해결 방법
해당 포트를 사용하는 프로세스를 종료시키는 방법과 서버 포트를 임의로 설정해주는 방법이 있다.
두번째 방법이 더 쉬우니까 나중에 알아보자.
프로세스 강제 종료
명령 프롬프트(CMD) 관리자 권한으로 실행
netstat -ano
(Ctrl C - 종료)
taskkill /F /pid 5132
8080 포트의 process id인 5132를 강제 종료한다.
mac
sudo lsof -i :<port>
포트 열려있는지 확인
ex) sudo lsof -i :10001
kill -9 <PID>
강제종료
ex ) kill -9 7113
해결
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.3)
2022-02-04 00:41:04.337 INFO 26024 --- [ main] hello.servlet.ServletApplication : Starting ServletApplication using Java 11.0.12 on DESKTOP-16SSFG6 with PID 26024 (C:\Spring\Projects\servlet\out\production\classes started by mycom in C:\Spring\Projects\servlet)
2022-02-04 00:41:04.343 INFO 26024 --- [ main] hello.servlet.ServletApplication : No active profile set, falling back to default profiles: default
2022-02-04 00:41:05.845 INFO 26024 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-02-04 00:41:05.861 INFO 26024 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-02-04 00:41:05.861 INFO 26024 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.56]
2022-02-04 00:41:05.988 INFO 26024 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-02-04 00:41:05.988 INFO 26024 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1513 ms
2022-02-04 00:41:06.392 INFO 26024 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-02-04 00:41:06.405 INFO 26024 --- [ main] hello.servlet.ServletApplication : Started ServletApplication in 2.932 seconds (JVM running for 6.848)
서버 포트 설정
매번 프로세스 종료하기 귀찮으니 사용 포트를 설정해주자.
src/resources/application.properties에 들어가서 설정
server.port=지정할 포트번호
해결
설정한 포트로 잘 실행되는 것을 볼 수 있다.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.3)
2022-02-04 00:47:52.669 INFO 28352 --- [ main] hello.servlet.ServletApplication : Starting ServletApplication using Java 11.0.12 on DESKTOP-16SSFG6 with PID 28352 (C:\Spring\Projects\servlet\out\production\classes started by mycom in C:\Spring\Projects\servlet)
2022-02-04 00:47:52.674 INFO 28352 --- [ main] hello.servlet.ServletApplication : No active profile set, falling back to default profiles: default
2022-02-04 00:47:54.315 INFO 28352 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8086 (http)
2022-02-04 00:47:54.326 INFO 28352 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-02-04 00:47:54.326 INFO 28352 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.56]
2022-02-04 00:47:54.421 INFO 28352 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-02-04 00:47:54.421 INFO 28352 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1563 ms
2022-02-04 00:47:54.873 INFO 28352 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8086 (http) with context path ''
2022-02-04 00:47:54.887 INFO 28352 --- [ main] hello.servlet.ServletApplication : Started ServletApplication in 2.943 seconds (JVM running for 5.08)
'Programming > Spring' 카테고리의 다른 글
[Spring] 서블릿 (0) | 2022.02.09 |
---|---|
[Spring Boot + Vue.js] 프로젝트 개발 환경 구성 (0) | 2022.02.07 |
[Spring] 프로젝트 생성 (0) | 2022.02.04 |
[Spring] 웹 애플리케이션 이해 (0) | 2022.02.03 |
[Spring] 빈 스코프 (0) | 2022.01.27 |