-
[Thymeleaf] template might not exist or might not be accessible by any of the configured Template Resolvers이슈 해결 2019. 2. 21. 14:40
template might not exist or might not be accessible by any of the configured Template Resolvers...
Thymeleaf를 사용하여 템플릿을 만들고 애플리케이션을 운영 서버에 배포하여 테스트하던 중...
URL로 페이지 접속 시 위와 같은 에러가 발생했다.
위와 같은 에러가 발생하는 이유는 아래와 같다.
1. 템플릿이 존재하지 않음
2. 템플릿 리졸버에서 접근할 수 없음
해결방안
1번의 경우엔 실제 HTML 파일이 존재하지 않음에도 참조하려고 하거나 다른 HTML 파일에서 fragment와 같은 타임리프 기능으로 존재하지 않는 HTML파일을 include할 때 발생한다.
2번의 경우 fragment와 같은 기능을 통해 HTML의 실제 위치를 현재 디렉토리에 대한 위치를 잡아주지 않아서 발생한다.
개발 환경에서는 /layout/myfile.html 과 같은 형식으로 작성해도 아무런 문제가 없지만 운영 서버에서는 이와같이 접근할 경우 문제가 발생한다.
./layout/myfile.html과 같이 경로를 지정해주면 된다.
'이슈 해결' 카테고리의 다른 글
[Docker] unauthorized: incorrect username or password. (0) 2019.03.17 [Spring Boot] This connection has been closed (0) 2019.03.05 [Docker] Error starting userland proxy: mkdir /port/tcp:0.0.0.0:port:tcp:0.0.0.0:port: input/output error (0) 2019.02.15 [Docker] docker: Error response from daemon: ... (1) 2019.01.30 [Eclipse] Missing 'tools.jar' (0) 2019.01.09