org.thymeleaf.exceptions.TemplateInputException
异常现象:在本地打包部署完全没有问题,资源文件也都可以映射上,但是打包成jar包部署到服务器上时,就一直报异常,异常信息如下:
- 严重: Servlet.service() for servlet [dispatcherServlet] in context with path []
- threw exception [Request processing failed; nested exception is org.thymeleaf.ex
- ceptions.TemplateInputException: Error resolving template "/emailInfoManager/ema
- ilInfoList", template might not exist or might not be accessible by any of the c
- onfigured Template Resolvers] with root cause
- org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/emai
- lInfoManager/emailInfoList", template might not exist or might not be accessible
- by any of the configured Template Resolvers
- at org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:
- 246)
- at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1104)
- at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060)
- at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011)
- at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView
- .java:335)
工程结构如下:
controller示例如下:
- @RequestMapping(value = "/findEmailInfoDataCriteria", method = RequestMethod.GET)
- public String findEmailInfoDataCriteria(@RequestParam(value = "page", defaultValue = "0") Integer page,
- @RequestParam(value = "size", defaultValue = "10") Integer size,
- @ModelAttribute("emailInfoData") EmailInfo emailInfo, ModelMap modelMap) {
- Page<EmailInfo> list = emailService.findEmailDataCriteria(page, size, emailInfo);
- modelMap.addAttribute("datas", list);
- return "/emailInfoManager/emailInfoList";
- }
经过大量的排查,最终的问题出在return "/emailInfoManager/emailInfoList";这行代码,去掉最前面的"/"就好了!
相关推荐
Spring Boot MultipartFile 文件上传遇到的三种问题,包括 ajax 传过去的参数在 Controller 中接受不到、`org.springframework.web.multipart.support.MissingServletRequestPartException` 异常和 `org.thymeleaf....
当你遇到"org.thymeleaf.exceptions.TemplateInputException: Error resolving template 'thymeleaf/index'"这样的错误时,这通常意味着Thymeleaf无法找到或解析你指定的模板文件。以下是一些可能的原因和解决策略:...
spring-boot-starter-thymeleaf     spring-boot-starter-web     spring-boot-starter-test org.mybatis.spring.boot     mybatis-...
spring-boot-starter-thymeleaf     spring-boot-starter-web     spring-boot-starter-test org.mybatis.spring.boot     mybatis-...
该应用程序演示了我的MVC Exceptions博客中涵盖的大多数要点: 。 发行历史 2013年11月:V1 2014年10月:V2 2018年4月:V2.0.1 2021年1月:V2.1.0 应用概述 最重要的文件是: 演示1 带有@ExceptionHand