본문으로 바로가기

SPRING 포트 충돌

category JAVA/Spring 2019. 10. 12. 23:33
반응형


.   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.8.RELEASE)

2019-09-27 12:07:02.265  INFO 22312 --- [           main] com.test.main.SpringBootTestApplication  : Starting SpringBootTestApplication on DA-PC-0280 with PID 22312 (C:\Java\SpringBootTest\target\classes started by admin in C:\Java\SpringBootTest)
2019-09-27 12:07:02.268  INFO 22312 --- [           main] com.test.main.SpringBootTestApplication  : No active profile set, falling back to default profiles: default
2019-09-27 12:07:03.145  INFO 22312 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-09-27 12:07:03.167  INFO 22312 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-09-27 12:07:03.167  INFO 22312 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.24]
2019-09-27 12:07:03.315  INFO 22312 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-09-27 12:07:03.315  INFO 22312 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1008 ms
2019-09-27 12:07:03.486  INFO 22312 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-09-27 12:07:03.625 ERROR 22312 --- [           main] org.apache.catalina.util.LifecycleBase   : Failed to start component [Connector[HTTP/1.1-8080]]

org.apache.catalina.LifecycleException: Protocol handler start failed
	at org.apache.catalina.connector.Connector.startInternal(Connector.java:1008) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227) [tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:263) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:195) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:297) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
	at com.test.main.SpringBootTestApplication.main(SpringBootTestApplication.java:10) [classes/:na]
Caused by: java.net.BindException: Address already in use: bind
	at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_201]
	at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_201]
	at sun.nio.ch.Net.bind(Unknown Source) ~[na:1.8.0_201]
	at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) ~[na:1.8.0_201]
	at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) ~[na:1.8.0_201]
	at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:230) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:213) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1124) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1210) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:585) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.catalina.connector.Connector.startInternal(Connector.java:1005) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	... 14 common frames omitted

Spring boot 프로젝트 예제를 따라하고 있었는데 웹 서버를 실행시키는 부분에서 console창에 에러 표시가 났습니다. 로그에 따르면 server가 이미 8080 포트를 작동 중이기 때문에 충돌이 나서 발생하는 에러를 확인했고

1. 사용중인 8080포트를 꺼준다.

       -> 윈도우 사용자일 경우 작업관리자에서 java.exe를 중단.

       -> 리눅스 사용자일 경우 프로세스 종료.

2. 실행시키려는 서버의 포트를 바꿔준다.

       -> application.properties에서 밑에 문구 수정. 80은 원하는 포트 번호를 입력.

server.port=80
반응형

'JAVA > Spring' 카테고리의 다른 글

톰켓 다운로드 및 이클립스 서버 설정하기  (0) 2020.03.01
Spring을 Eclipse에 설치하기  (0) 2020.02.29
DI(Dependency injection) 의존 주입  (0) 2019.11.27
SPRING 외부 접근  (0) 2019.10.12
pom.xml 첫줄 에러  (0) 2019.10.12