localhost:8080 Whitelabel Error Page 뜹니다...
611
작성한 질문수 1
=========================================
[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? (예/아니오)
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)
3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)
[질문 내용]
안녕하세요, 해당 static 폴더에 index.html파일에 코드를 입력한후 서버 실행결과 whilelabel 에러가 뜹니다.
해결에 도움을 주시면 감사하겠습니다..

콘솔 내용
:: Spring Boot :: (v3.3.3)
2024-08-26T17:27:55.146+09:00 INFO 4895 --- [ main] h.hello_spring.HelloSpringApplication : Starting HelloSpringApplication using Java 17.0.12 with PID 4895 (/Users/kipyo/Documents/스프링/hello-spring/out/production/classes started by kipyo in /Users/kipyo/Documents/스프링/hello-spring)
2024-08-26T17:27:55.148+09:00 INFO 4895 --- [ main] h.hello_spring.HelloSpringApplication : No active profile set, falling back to 1 default profile: "default"
2024-08-26T17:27:55.573+09:00 INFO 4895 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2024-08-26T17:27:55.580+09:00 INFO 4895 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-08-26T17:27:55.580+09:00 INFO 4895 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.28]
2024-08-26T17:27:55.606+09:00 INFO 4895 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-08-26T17:27:55.607+09:00 INFO 4895 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 433 ms
2024-08-26T17:27:55.743+09:00 WARN 4895 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)
2024-08-26T17:27:55.768+09:00 INFO 4895 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
2024-08-26T17:27:55.772+09:00 INFO 4895 --- [ main] h.hello_spring.HelloSpringApplication : Started HelloSpringApplication in 0.793 seconds (process running for 0.952)


답변 2
0
안녕하세요. 도도한 황새님, 공식 서포터즈 OMG입니다.
강의를 참고하여 templates 폴더 하위에 hello.html 파일을 생성하는 과정까지 진행해서 확인해보시겠어요?
resources/templates/ 경로에 파일이 없어서 발생하는 오류로 보입니다 😀
해결이 안될 경우 댓글 남겨주세요.

감사합니다.
0
안녕하세요, 인프런 AI 인턴입니다.
에러 메시지 중 Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false) 부분에 주목해보실 필요가 있습니다. 이 메시지는 Spring Boot에서 Thymeleaf 템플릿의 기본 위치인 classpath:/templates/ 디렉토리를 찾을 수 없다는 의미입니다. index.html 파일이 static 폴더에 위치해 있는 경우, Spring Boot의 기본 정적 리소스 핸들링에 따라 접근이 가능해야 하지만, 템플릿 엔진 관련 설정이나 디렉토리 구조에 문제가 있을 수 있습니다.
비슷한 문제를 해결하는 데 도움이 될 수 있는 몇 가지 포인트는 다음과 같습니다:
- Thymeleaf 사용 시: index.html 파일이 src/main/resources/templates 디렉토리에 위치해 있어야 합니다.
- 정적 리소스 접근 시: index.html 파일은 src/main/resources/static 디렉토리에 있어야 정적 파일로서 접근할 수 있습니다.
해당 문제를 직접적으로 다룬 Whitelabel Error Page 글에서는 IntelliJ의 캐시를 클리어하는 방법 (File -> Invalidate Caches / Restart)으로 해결된 경우가 있습니다. 이는 IDE 수준의 문제로 인해 발생한 경우 해결책이 될 수 있습니다.
테스트 중 index.html을 사용하지 않고 Thymeleaf 등 템플릿 엔진을 사용하는 경우, 템플릿 파일 위치나 설정을 확인해야 합니다. 구체적으로, Spring Boot 프로젝트의 application.properties 또는 application.yml 설정 파일에서 템플릿 엔진 설정을 확인하고, 필요한 경우 spring.thymeleaf.prefix와 spring.thymeleaf.suffix 등을 조정해볼 수 있습니다.
질문에 주어진 에러 메시지와 컨텍스트를 바탕으로 여러 해결 방안을 시도해보시기 바랍니다. 다만, 이러한 해결책이 즉시 적용될지는 프로젝트의 구체적인 세팅과 현재 구성에 따라 다를 수 있음을 참고해주시기 바랍니다.
저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.
..
0
76
2
Unused property.....
0
99
2
project JDK is misconfigured
0
132
2
외부 API의 ID 타입(String/UUID)과 내부 도메인의 ID 타입(Long)이 불일치할 때의 설계 정석
0
82
2
단위/통합 테스트 버전충돌 문제
0
91
2
❗️springboot 4.0.2 버전 aspectj dependency 설정❗️
0
229
1
왜 컨트롤러는 변한게 없는데 새로 만든 html 파일이 뜨나요?
0
102
2
윈도우 build test오류 질문
1
102
2
테스트 관련 공부에 대한 조언을 얻고 싶습니다
0
99
2
테스트 실행 시 에러 질문
0
291
1
name을 통한 비교와 객체를 통한 비교
0
77
1
빌드 후 libs 없음
1
129
1
윈도우 gradlew.bat 에러
0
167
1
@PostMapping("/members/new")가 동작하지 않습니다
0
88
1
java static class와 kotlin class
0
77
1
스프링 DB연결
0
126
1
소요 시간
0
85
2
ddl.sql에 빨간 밑줄
1
101
2
welcome page 에러
0
181
3
잘 모르겠습니다.
0
163
2
fail을 똑같이 쳤는데 오류가 발생해요
0
156
2
index.html Welcome page
0
121
1
프로젝트 gradle-groovy ?
0
369
1
테스트코드 메서드명 한글
0
201
2





