spring boot部署中异常:org.thymeleaf.exceptions.TemplateInputException

org.thymeleaf.exceptions.TemplateInputException

 

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

 

[java]  view plain  copy
 
  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.         at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1104)  
  12.         at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060)  
  13.         at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011)  
  14.         at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView  
  15. .java:335)  


工程结构如下:

 

controller示例如下:

 

[java]  view plain  copy
 
  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.         modelMap.addAttribute("datas", list);  
  7.         return "/emailInfoManager/emailInfoList";  
  8.     }  

 

 

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

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值