spring boot部署中异常:org.thymeleaf.exceptions.TemplateInputException
  C5bk9rm9TFUo 2023年11月02日 54 0


org.thymeleaf.exceptions.TemplateInputException

 

异常现象:在本地打包部署完全没有问题,资源文件也都可以映射上,但是打包成jar包部署到服务器上时,就一直报异常,异常信息如下:

 

1. 严重: Servlet.service() for servlet [dispatcherServlet] in context with path []  
2. threw exception [Request processing failed; nested exception is org.thymeleaf.ex  
3. ceptions.TemplateInputException: Error resolving template "/emailInfoManager/ema  
4. ilInfoList", template might not exist or might not be accessible by any of the c  
5. onfigured Template Resolvers] with root cause  
6. org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/emai  
7. lInfoManager/emailInfoList", template might not exist or might not be accessible  
8.  by any of the configured Template Resolvers  
9.         at org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:  
10. 246)  
11. 1104)  
12. 1060)  
13. 1011)  
14.         at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView  
15. .java:335)


工程结构如下:

 

spring boot部署中异常:org.thymeleaf.exceptions.TemplateInputException_异常信息

controller示例如下:

 

1. @RequestMapping(value = "/findEmailInfoDataCriteria", method = RequestMethod.GET)  
2. public String findEmailInfoDataCriteria(@RequestParam(value = "page", defaultValue = "0") Integer page,  
3. @RequestParam(value = "size", defaultValue = "10") Integer size,  
4. @ModelAttribute("emailInfoData") EmailInfo emailInfo, ModelMap modelMap) {  
5.         Page<EmailInfo> list = emailService.findEmailDataCriteria(page, size, emailInfo);  
6. "datas", list);  
7. return "/emailInfoManager/emailInfoList";  
8.     }

 

经过大量的排查,最终的问题出在return "/emailInfoManager/emailInfoList";这行代码,去掉最前面的"/"就好了!

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
C5bk9rm9TFUo