- 화면 이름을 잘못 돌려줄 때
- 바꾸는 코드 TodoController의 return "list"; 를 return "lists"; 로 바꿉니다.
▼ Code
Path: 콘솔
ERROR org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8080-exec-1] Exception processing template "lists": Error resolving template [lists], template might not exist or might not be accessible by any of the configured Template Resolvers org.thymeleaf.exceptions.TemplateInputException: Error resolving template [lists], template might not exist or might not be accessible by any of the configured Template Resolvers
핵심 메시지
Error resolving template [lists], template might not exist
- 뜻 컨트롤러가 돌려준 lists라는 이름의 템플릿 파일이 없습니다. 브라우저에는 500 오류가 납니다.
- 고칠 곳 return 값을 "list"로 고칩니다.
- 템플릿에서 속성 이름을 잘못 적을 때
- 바꾸는 코드 list.html의 ${todo.title}을 ${todo.titel}로 바꾸고 할 일이 한 건 이상 있는 상태에서 목록을 엽니다.
▼ Code
Path: 콘솔
ERROR org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8080-exec-1] Exception processing template "list": An error happened during template parsing (template: "class path resource [templates/list.html]" - line 24, col 17)
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "todo.titel" (template: "list" - line 24, col 17)
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'titel' cannot be found on object of type 'com.example.todo.domain.Todo' - maybe not public or not valid?
핵심 메시지
EL1008E: Property or field 'titel' cannot be found on object of type 'com.example.todo.domain.Todo'
- 뜻 Todo에 titel이라는 속성이 없습니다. 콘솔의 template: "list" - line 24는 이 장의 list.html 24행, 곧 ${todo.title}이 있는 줄을 가리킵니다. col은 그 줄에서 th:text 속성이 시작하는 칸입니다.
- 고칠 곳 ${todo.title}로 되돌립니다. 할 일이 없으면 그 줄을 그리지 않으므로 이 오류도 나지 않습니다.
콘솔 오류 읽는 순서
스프링 오류는 수십 줄이 한꺼번에 나옵니다. 처음부터 끝까지 읽지 않고 아래 순서로 읽을 곳만 찾습니다.
위쪽 첫 줄은 바깥에서 감싼 예외인 경우가 많아, 그 줄만 보면 실제 원인을 놓치기 쉽습니다. 감싼 예외의 원인은 아래쪽 Caused by로 이어지고, 여러 개면 가장 아래 Caused by가 뿌리 원인입니다.
- 맨 아래쪽부터 위로 올라가며 ERROR 줄과 APPLICATION FAILED TO START를 찾습니다.
- Caused by 줄을 찾습니다. 여러 개면 가장 아래의 Caused by가 가장 구체적인 원인입니다.
- 그 줄에서 예외 이름(콜론 앞)과 메시지(콜론 뒤)를 나눠 읽습니다.
- at com.example.todo 로 시작하는 줄이 있으면 내 코드의 파일 이름과 줄 번호입니다. 그 줄을 엽니다.
- 메시지가 가리키는 곳이 컴파일, 설정과 데이터베이스, 템플릿, 요청 주소 중 어디인지 정합니다.
개인정보처리방침 · 이용약관