当前位置: 代码迷 >> 综合 >> org.thymeleaf.TemplateEngine template might not exist or might not be accessible by any of the c
  详细解决方案

org.thymeleaf.TemplateEngine template might not exist or might not be accessible by any of the c

热度:104   发布时间:2023-10-13 12:01:42.0

springboot运行thymeleaf渲染的项目时可能会报这样的错误

2021-02-26 15:05:25.083 ERROR 11432 --- [nio-8080-exec-1] org.thymeleaf.TemplateEngine             : [THYMELEAF][http-nio-8080-exec-1] Exception processing template "login": Error resolving template [login], template might not exist or might not be accessible by any of the configured Template Resolversorg.thymeleaf.exceptions.TemplateInputException: Error resolving template [login], template might not exist or might not be accessible by any of the configured Template Resolversat org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) [thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) [thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:362) [thymeleaf-spring5-3.0.11.RELEASE.jar:3.0.11.RELEASE]

问题分析

①、先检查打包之后的目录结构,看看target中是否打包进了webapp文件夹下的内容。
org.thymeleaf.TemplateEngine template might not exist or might not be accessible by any of the c
②、浏览器访问页面打开debuger调试功能,查看是否有其他的报错。
③、看看controller层返回的注解结构是否符合要求,@RestController、@ResponseBody是否滥用。比如:
? ?? 如果需要返回页面使用 @Controller
? ?? 如果需要返回 字符串或自定义对象 ,使用 @RestController / @ResponseBody

解决办法

org.thymeleaf.TemplateEngine template might not exist or might not be accessible by any of the c
org.thymeleaf.TemplateEngine template might not exist or might not be accessible by any of the c

  相关解决方案