๐Ÿ“‘ ErrorNote

๐ŸŸข [ SpringBoot ] [ AWS EC2 ] TemplateInputException

Dbswnstjd 2023. 10. 24. 10:39

AWS EC2 Spring Boot ๋ฐฐํฌ ์‹œ TemplateInputException ์˜ค๋ฅ˜

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception 
[Request processing failed: org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/ip/ipinfo],
template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause

EC2 ์„œ๋ฒ„์— ๋ฐฐํฌํ•˜๋Š” ๋„์ค‘ TemplateInputException์ด ๋ฐœ์ƒํ•˜์—ฟ๋‹ค.  URL์ด ์ž˜๋ชป๋˜์—ˆ๋‹ค๋Š” ์—๋Ÿฌ๊ฐ™์€๋ฐ application.properties๋‚˜ Controller๋ฅผ ์ฐพ์•„๋ด๋„ ๋ฌธ์ œ์ ์ด ์—†์—ˆ๋‹ค. ๋˜ํ•œ ๋กœ์ปฌ์—์„œ๋Š” ์ž˜ ๋˜์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด๋Ÿฌํ•œ ์˜ค๋ฅ˜๋ฅผ ์ฐพ์ง€ ๋ชปํ•˜์˜€๋‹ค. ๊ทธ๋ž˜์„œ ๊ตฌ๊ธ€๋ง์„ ํ•˜๋˜ ๋„์ค‘ ๋‚˜์™€ ๋˜‘๊ฐ™์€ ๋ถ„์„ ์ฐพ์•˜๋‹ค. 

controller์—์„œ return๊ฐ’์— "/xxx"์™€ ๊ฐ™์€ ํ˜•ํƒœ๋ฅผ ์ ์„ ๊ฒฝ์šฐ, ๋ฆฌ๋ˆ…์Šค๋Š” ์ด๋ฅผ ์ธ์‹ํ•˜์ง€ ๋ชปํ•ด ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ํ™”๋ฉด์— ์ ‘๊ทผํ•˜์ง€ ๋ชปํ•  ์ˆ˜ ์žˆ๋‹ค.

๋ผ๊ณ  ํ•œ๋‹ค. ์–ด์ œ ๋ถ€ํ„ฐ ๊ณ„์† ์˜ค๋ฅ˜๋ฅผ ๋ชป์ฐพ๋‹ค๊ฐ€ ์ปจํŠธ๋กค๋Ÿฌ์— return ํ• ๋•Œ ๋งจ ์•ž์— /๋ฅผ ๋นผ๋‹ˆ ๋ฐ”๋กœ ํ•ด๊ฒฐ์ด ๋˜์—ˆ๋‹ค.

 

์ถœ์ฒ˜: https://gaebalsogi.tistory.com/58