728x90
반응형
1. 문제 상황 정의하기
spring boot 프로젝트를 실행할 때 아무런 에러를 내뱉지 않고 프로젝트가 꺼지면 당황스럽다.
아래 사진을 보면 프로젝트 실행과 동시에 ‘process finished with exit code 1’과 함께 종료된다.
![](https://github.com/graygreat/blog-code/blob/main/spring/spring_boot_%EC%8B%A4%ED%96%89_%ED%9B%84_%E2%80%98process_finished_with_exit_code_1%E2%80%99%EC%99%80_%ED%95%A8%EA%BB%98_%EC%A2%85%EB%A3%8C%EB%90%A0_%EB%95%8C/image/1.png?raw=true)
2. 해결하기
2-1. Main method에서 error 잡기
main 문에서 다음과 같이 try-catch를 사용해서 에러를 출력해보면 프로젝트에 무슨 문제가 있는지 알 수 있다.
![](https://github.com/graygreat/blog-code/blob/main/spring/spring_boot_%EC%8B%A4%ED%96%89_%ED%9B%84_%E2%80%98process_finished_with_exit_code_1%E2%80%99%EC%99%80_%ED%95%A8%EA%BB%98_%EC%A2%85%EB%A3%8C%EB%90%A0_%EB%95%8C/image/2.png?raw=true)
2-2.Port 검색 후 종료
Mac에서는 lsof를 통해 해당 포트로 떠있는 프로세스를 검색할 수 있다.
![](https://github.com/graygreat/blog-code/blob/main/spring/spring_boot_%EC%8B%A4%ED%96%89_%ED%9B%84_%E2%80%98process_finished_with_exit_code_1%E2%80%99%EC%99%80_%ED%95%A8%EA%BB%98_%EC%A2%85%EB%A3%8C%EB%90%A0_%EB%95%8C/image/3.png?raw=true)
![](https://github.com/graygreat/blog-code/blob/main/spring/spring_boot_%EC%8B%A4%ED%96%89_%ED%9B%84_%E2%80%98process_finished_with_exit_code_1%E2%80%99%EC%99%80_%ED%95%A8%EA%BB%98_%EC%A2%85%EB%A3%8C%EB%90%A0_%EB%95%8C/image/4.png?raw=true)
출력된 에러의 내용처럼 이미 8080 포트가 작동 중이었고 그 포트를 제거해주면 된다
![](https://github.com/graygreat/blog-code/blob/main/spring/spring_boot_%EC%8B%A4%ED%96%89_%ED%9B%84_%E2%80%98process_finished_with_exit_code_1%E2%80%99%EC%99%80_%ED%95%A8%EA%BB%98_%EC%A2%85%EB%A3%8C%EB%90%A0_%EB%95%8C/image/5.png?raw=true)
반응형
'Spring' 카테고리의 다른 글
WireMock을 사용한 openFeign 테스트하기 (0) | 2023.05.14 |
---|---|
@Transactional 동작 원리 (0) | 2021.07.30 |
Transaction/@Transactional 이해하기 (0) | 2021.07.17 |
AOP 이해하기 (1) | 2021.07.14 |
Spring Boot로 CORS 해결하기 (0) | 2021.04.05 |
댓글