🌥️Cloud Study🌥️/TroubleShooting
오류 : Web server failed to start. Port 8080 was already in use.
L_Chae
2024. 7. 24. 11:50
***************************
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.
AWS에서 인스턴스 유형을 변경하느라 중단하고 다시 올린 다음 Spring Boot 기반의 웹서버를 구동했더니 위와 같은 오류가 출력되었다.
# application.porperties 파일에 추가하거나 수정 :
server.port=9090
# 커맨드 라인에서 설정 :
java -jar your-application.jar --server.port=9090
# Gradle을 사용하는 경우
./gradlew bootRun -Pargs=--server.port=9090
# Maven을 사용하는 경우
mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=9090
기존 포트를 변경하기 위해서는 application.porperties 파일 또는 application.yaml 파일을 위와 같이 수정해주면 되는데,
사실 아래의 .jar 파일을 실행할 때 명시적으로 지정해 주는 방법이 제일 빠르고 편하다.