에러해결모음

# 배포 타임리프 경로 에러 -org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing

뭉지맘 2025. 3. 11. 17:09

배포하니까 에러가 나고 실행이 안되서 매우 당황스러웠는데

org.thymeleaf.TemplateEngine: [THYMELEAF][http-nio-8090-exec-1] Exception processing template "index": 
An error happened during template parsing (template: "class path resource [templates/index.html]")

org.thymeleaf.exceptions.TemplateInputException: 
An error happened during template parsing 
(template: "class path resource [templates/index.html]")

에러가 굉장히 길지만 대충 위쪽을 읽어보니 타임리프 관련 속성이 에러가 있는것 같았다.

 

문제는 타임리프에서

th:replace= 로 가져올때 맨앞부분에 /를 포함시켜서 일어난 것이었다.

 

예시

<!-- # 날씨 데이터 -->
<th:block th:replace="~{/comp/weather :: weatherFragment}">
</th:block>

이렇게 되어있던걸

<!-- # 날씨 데이터 -->
<th:block th:replace="~{comp/weather :: weatherFragment}">
</th:block>

이렇게 바꿔주니 해결되었다.