인프런 커뮤니티 질문&답변

황상익님의 프로필 이미지
황상익

작성한 질문수

스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술

서블릿으로 회원 관리 웹 애플리케이션 만들기

webapp 연동 문의

작성

·

739

0

localhost 8080에 들어갈 때 시작 페이지가 whitepage로 떠서 다시 문의 들입니다.
webapp의 시작 페이지가 적용이 안되는 것 같은데 원인을 잘 모르겠습니다.

프로젝트 파일은 구글 드라이브로 링크 남기겠습니다.

감사합니다.

https://drive.google.com/file/d/1LAeBuz3E_PZGdqTg4bzgw8Ocn7WB2KyV/view?usp=share_link

답변 1

0

안녕하세요. 황상익님, 공식 서포터즈 OMG입니다.
프로젝트 코드 확인해보았습니다.

 

imageimage

별다른 수정 없이 프로젝트 시작 시 정상 실행되었습니다.

윈도우 콘솔에서 출력되는 메시지가 있을 것 같은데 확인해보시겠어요?

추가로 크롬 브라우저에서 ctrl + shift + n 을 입력하여 시크릿창에서 확인해주세요.



감사합니다.

황상익님의 프로필 이미지
황상익
질문자

오후 3:20:25: Executing ':ServletApplication.main()'...

> Task :compileJava UP-TO-DATE

> Task :processResources UP-TO-DATE

> Task :classes UP-TO-DATE

> Task :ServletApplication.main()

. ____ _

/\\ / ___'_ __ (_)_ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

\\/ ___)| |_)| | | | | || (_| | ) ) ) )

' |____| .__|_| |_|_| |_\__, | / / / /

=========|_|==============|___/=/_/_/_/

:: Spring Boot :: (v2.4.3)

2023-01-29 15:20:27.820 INFO 7908 --- [ main] hello.servlet.ServletApplication : Starting ServletApplication using Java 18.0.2 on DESKTOP-O4BLJMI with PID 7908 (C:\Users\hwang\IdeaProjects\servlet\servlet\build\classes\java\main started by hwang in C:\Users\hwang\IdeaProjects\servlet)

2023-01-29 15:20:27.823 INFO 7908 --- [ main] hello.servlet.ServletApplication : No active profile set, falling back to default profiles: default

2023-01-29 15:20:29.335 INFO 7908 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)

2023-01-29 15:20:29.363 INFO 7908 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]

2023-01-29 15:20:29.364 INFO 7908 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.43]

2023-01-29 15:20:29.481 INFO 7908 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext

2023-01-29 15:20:29.481 INFO 7908 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1565 ms

2023-01-29 15:20:29.904 INFO 7908 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'

2023-01-29 15:20:30.321 INFO 7908 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''

2023-01-29 15:20:30.339 INFO 7908 --- [ main] hello.servlet.ServletApplication : Started ServletApplication in 3.128 seconds (JVM running for 3.618)

2023-01-29 15:20:34.900 DEBUG 7908 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer : Before fill(): [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position() [0]

2023-01-29 15:20:34.901 DEBUG 7908 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer : Received [GET / HTTP/1.1

Host: localhost:8080

Connection: keep-alive

Cache-Control: max-age=0

sec-ch-ua: "Not_A Brand";v="99", "Google Chrome";v="109", "Chromium";v="109"

sec-ch-ua-mobile: ?0

sec-ch-ua-platform: "Windows"

Upgrade-Insecure-Requests: 1

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9

Sec-Fetch-Site: none

Sec-Fetch-Mode: navigate

Sec-Fetch-User: ?1

Sec-Fetch-Dest: document

Accept-Encoding: gzip, deflate, br

Accept-Language: ko-KR,ko;q=0.9

]

2023-01-29 15:20:34.932 INFO 7908 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'

2023-01-29 15:20:34.933 INFO 7908 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'

2023-01-29 15:20:34.933 INFO 7908 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 0 ms

2023-01-29 15:20:35.015 DEBUG 7908 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer : Before fill(): [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position() [0]

2023-01-29 15:20:35.015 DEBUG 7908 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer : Received []

2023-01-29 15:20:35.016 DEBUG 7908 --- [nio-8080-exec-1] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@6f69190a:org.apache.tomcat.util.net.NioChannel@19f63bb8:java.nio.channels.SocketChannel[connected local=/[0:0:0:0:0:0:0:1]:8080 remote=/[0:0:0:0:0:0:0:1]:52442]], Status in: [OPEN_READ], State out: [OPEN]

image

해결이 되지 않아 다시 문의 드립니다.
console 창 메시지랑 현 상태랑 같이 해서 올립니다 .
감사합니다

저의 경우 아래와 같이 톰캣 실행로그 전 welcomepage가 잡히는데 보이지 않네요.

image동일한 코드가 맞다면 자바 버전, 인텔리제이 세팅 등의 문제이지 않나 싶은데요.

자바 버전을 11로 확인해보셔야 할 것 같아요.

build.gradle의 sourceCompatibilitiy도 11로 맞춰주셔야 하구요.

plugins {
   id 'java'
   id 'war'
   id 'org.springframework.boot' version '2.4.3'
   id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}

group = 'hello'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '8'

 

그전에 index.html을 직접 접근했을 때 어떤지 확인 먼저 해주시면 많은 도움이 될 것 같아요.

http://localhost:8080/index.html

 

황상익님의 프로필 이미지
황상익
질문자

http://localhost:8080/index.html 또한 whitepage로 나타납니다
Java는 11로 변경했습니다만 톰켓 웰컴페이지는 보이지 않네요
setting에서도 11로 변경했습니다.

image

preferences에서 build and run using 과 Run tests using을 Gradle로 하셨을까요?

IntelliJ라면 Gradle로 변경해서 확인해주세요

황상익님의 프로필 이미지
황상익
질문자

넵 다 gradle로 setting 되어있습니다.

황상익님의 프로필 이미지
황상익
질문자

오후 6:23:14: Executing ':ServletApplication.main()'...

> Task :compileJava

> Task :processResources

> Task :classes

> Task :ServletApplication.main()

. ____ _

/\\ / ___'_ __ (_)_ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

\\/ ___)| |_)| | | | | || (_| | ) ) ) )

' |____| .__|_| |_|_| |_\__, | / / / /

=========|_|==============|___/=/_/_/_/

:: Spring Boot :: (v2.4.3)

2023-01-30 18:23:26.049 INFO 5432 --- [ main] hello.servlet.ServletApplication : Starting ServletApplication using Java 11.0.18 on DESKTOP-O4BLJMI with PID 5432 (C:\Users\hwang\IdeaProjects\servlet-Omg\servlet-Omg\servlet\build\classes\java\main started by hwang in C:\Users\hwang\IdeaProjects\servlet-Omg)

2023-01-30 18:23:26.054 INFO 5432 --- [ main] hello.servlet.ServletApplication : No active profile set, falling back to default profiles: default

2023-01-30 18:23:28.181 INFO 5432 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)

2023-01-30 18:23:28.215 INFO 5432 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]

2023-01-30 18:23:28.216 INFO 5432 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.43]

2023-01-30 18:23:28.428 INFO 5432 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext

2023-01-30 18:23:28.429 INFO 5432 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2248 ms

2023-01-30 18:23:28.933 INFO 5432 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'

2023-01-30 18:23:29.262 INFO 5432 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''

2023-01-30 18:23:29.282 INFO 5432 --- [ main] hello.servlet.ServletApplication : Started ServletApplication in 4.041 seconds (JVM running for 5.011)

2023-01-30 18:23:47.662 DEBUG 5432 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer : Before fill(): [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position() [0]

2023-01-30 18:23:47.662 DEBUG 5432 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer : Received [GET / HTTP/1.1

Host: localhost:8080

Connection: keep-alive

sec-ch-ua: "Not_A Brand";v="99", "Google Chrome";v="109", "Chromium";v="109"

sec-ch-ua-mobile: ?0

sec-ch-ua-platform: "Windows"

Upgrade-Insecure-Requests: 1

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9

Purpose: prefetch

Sec-Fetch-Site: none

Sec-Fetch-Mode: navigate

Sec-Fetch-User: ?1

Sec-Fetch-Dest: document

Accept-Encoding: gzip, deflate, br

Accept-Language: ko-KR,ko;q=0.9

]

2023-01-30 18:23:47.729 INFO 5432 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'

2023-01-30 18:23:47.729 INFO 5432 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'

2023-01-30 18:23:47.730 INFO 5432 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms

2023-01-30 18:23:47.834 DEBUG 5432 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer : Before fill(): [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position() [0]

2023-01-30 18:23:47.835 DEBUG 5432 --- [nio-8080-exec-1] o.a.coyote.http11.Http11InputBuffer : Received []

2023-01-30 18:23:47.835 DEBUG 5432 --- [nio-8080-exec-1] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@1fe94776:org.apache.tomcat.util.net.NioChannel@5148fc24:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:58540]], Status in: [OPEN_READ], State out: [OPEN]

2023-01-30 18:23:48.405 DEBUG 5432 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer : Before fill(): [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position() [0]

2023-01-30 18:23:48.406 DEBUG 5432 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer : Received [GET /favicon.ico HTTP/1.1

Host: localhost:8080

Connection: keep-alive

sec-ch-ua: "Not_A Brand";v="99", "Google Chrome";v="109", "Chromium";v="109"

sec-ch-ua-mobile: ?0

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

sec-ch-ua-platform: "Windows"

Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8

Sec-Fetch-Site: same-origin

Sec-Fetch-Mode: no-cors

Sec-Fetch-Dest: image

Referer: http://localhost:8080/

Accept-Encoding: gzip, deflate, br

Accept-Language: ko-KR,ko;q=0.9

]

2023-01-30 18:23:48.545 DEBUG 5432 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer : Before fill(): [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position() [0]

2023-01-30 18:23:48.545 DEBUG 5432 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer : Received []

2023-01-30 18:23:48.546 DEBUG 5432 --- [nio-8080-exec-3] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@1fe94776:org.apache.tomcat.util.net.NioChannel@5148fc24:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:58540]], Status in: [OPEN_READ], State out: [OPEN]

2023-01-30 18:23:49.712 DEBUG 5432 --- [nio-8080-exec-4] o.a.coyote.http11.Http11InputBuffer : Before fill(): [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position() [0]

2023-01-30 18:23:49.723 DEBUG 5432 --- [nio-8080-exec-4] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header

java.io.EOFException: null

at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1322) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1232) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:791) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:359) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:261) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

2023-01-30 18:23:49.725 DEBUG 5432 --- [nio-8080-exec-4] o.apache.coyote.http11.Http11Processor : Error state [CLOSE_CONNECTION_NOW] reported while processing request

java.io.EOFException: null

at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1322) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1232) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:791) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:359) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:261) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:887) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1684) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.43.jar:9.0.43]

at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

2023-01-30 18:23:49.726 DEBUG 5432 --- [nio-8080-exec-4] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@1fe94776:org.apache.tomcat.util.net.NioChannel@5148fc24:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:58540]], Status in: [OPEN_READ], State out: [CLOSED]

여전히 그대로 뜹니다
다시 만들어야 할까요??

프로젝트를 다시 만들어서 확인해주세요.

코드는 재사용 해도 됩니다.

황상익님의 프로필 이미지
황상익
질문자

넵 알겠습니다~ 다시 해보겠습니다.

황상익님의 프로필 이미지
황상익

작성한 질문수

질문하기