- [Spring Boot][Trouble Shooting] Windows에서 8080포트 죽이기 : Web server failed to start. Port 8080 was already in use.2022년 09월 13일 11시 52분 39초에 업로드 된 글입니다.작성자: DandyNow728x90반응형
java -jar 파일명.jar
gradle로 빌드한 jar 파일을 위 명령어로 실행했는데 8080 포트가 이미 사용 중이라는 에러가 발생했다. 코드를 수정하고 다시 빌드하는 일은 번거롭기 때문에 기존에 실행 중인 8080 포트를 죽이기로 했다.
Microsoft Windows [Version 10.0.19044.1889] (c) Microsoft Corporation. All rights reserved. C:\Users\J\Documents\GitHub\spring-boot-webservice-java11\spring-webservice\build\libs>java -jar spring-webservice-0.0.1-SNAPSHOT.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.6.8) 2022-09-13 11:32:28.201 INFO 5840 --- [ main] c.t.p.book.springboot.Application : Starting Application using Java 11.0.16 on DESKTOP-TFCC8U3 with PID 5840 (C:\Users\J\Documents\GitHub\spring-boot-webservice-java11\spring-webservice\build\libs\spring-webservice-0.0.1-SNAPSHOT.jar started by J in C:\Users\J\Documents\GitHub\spring-boot-webservice-java11\spring-webservice\build\libs) 2022-09-13 11:32:28.208 INFO 5840 --- [ main] c.t.p.book.springboot.Application : The following 1 profile is active: "oauth" 2022-09-13 11:32:29.594 INFO 5840 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2022-09-13 11:32:29.671 INFO 5840 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 64 ms. Found 2 JPA repository interfaces. 2022-09-13 11:32:30.824 INFO 5840 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2022-09-13 11:32:30.840 INFO 5840 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2022-09-13 11:32:30.841 INFO 5840 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.63] 2022-09-13 11:32:30.961 INFO 5840 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2022-09-13 11:32:30.962 INFO 5840 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2644 ms 2022-09-13 11:32:31.287 INFO 5840 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2022-09-13 11:32:31.526 INFO 5840 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2022-09-13 11:32:31.744 INFO 5840 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2022-09-13 11:32:31.810 INFO 5840 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.9.Final 2022-09-13 11:32:32.113 INFO 5840 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} 2022-09-13 11:32:32.279 INFO 5840 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect Hibernate: drop table if exists posts Hibernate: drop table if exists user Hibernate: create table posts (id bigint not null auto_increment, created_date datetime(6), modified_date datetime(6), author varchar(255), content TEXT not null, title varchar(500) not null, primary key (id)) engine=InnoDB Hibernate: create table user (id bigint not null auto_increment, created_date datetime(6), modified_date datetime(6), email varchar(255) not null, name varchar(255) not null, picture varchar(255), role varchar(255) not null, primary key (id)) engine=InnoDB 2022-09-13 11:32:33.177 INFO 5840 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2022-09-13 11:32:33.189 INFO 5840 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2022-09-13 11:32:33.255 INFO 5840 --- [ main] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:testdb' 2022-09-13 11:32:33.961 WARN 5840 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2022-09-13 11:32:34.446 INFO 5840 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@bbd4791, org.springframework.security.web.context.SecurityContextPersistenceFilter@2b0dc227, org.springframework.security.web.header.HeaderWriterFilter@55651434, org.springframework.security.web.authentication.logout.LogoutFilter@210d2a6c, org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter@261db982, org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter@ae73c80, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@470d183, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@40a72ecd, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@43bdaa1b, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@2a334bac, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@73971965, org.springframework.security.web.session.SessionManagementFilter@50448409, org.springframework.security.web.access.ExceptionTranslationFilter@4ed4a7e4, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@7523a3dc] 2022-09-13 11:32:34.764 INFO 5840 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index 2022-09-13 11:32:35.072 INFO 5840 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator' 2022-09-13 11:32:35.121 WARN 5840 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.PortInUseException: Port 8080 is already in use 2022-09-13 11:32:35.127 INFO 5840 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2022-09-13 11:32:35.129 INFO 5840 --- [ main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' Hibernate: drop table if exists posts Hibernate: drop table if exists user 2022-09-13 11:32:35.141 INFO 5840 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2022-09-13 11:32:35.147 INFO 5840 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. 2022-09-13 11:32:35.154 INFO 5840 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2022-09-13 11:32:35.177 INFO 5840 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-09-13 11:32:35.202 ERROR 5840 --- [ 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. C:\Users\J\Documents\GitHub\spring-boot-webservice-java11\spring-webservice\build\libs>
netstat -a -o
netstat 명령으로 8080 포트의 PID번호를 확인한다.
taskkill /f /pid PID번호
taskkill 명령으로 해당 프로세스를 종료시킨다. 만약 프로세스 종료가 안된다면 관리자 모드로 cmd를 실행해 진행하면 된다.
✎ 참고: https://devbirdfeet.tistory.com/36
728x90반응형'언어·프레임워크 > Spring Boot' 카테고리의 다른 글
[Spring Boot] gradle lombok Slf4j로 테스트 코드 로그 찍기 (0) 2024.04.10 [Spring Boot] MySQL 연동 application.yml 설정 (1) 2024.04.08 [Spring Boot][Trouble Shooting] gradlew build 실패 (0) 2022.09.13 [Spring Boot][Trouble Shooting] gradlew test 실패 (0) 2022.09.12 [Spring Boot][문제해결] STS에서 Mustache 사용 설정 및 한글 깨짐 문제 해결 (0) 2022.09.08 댓글