spring boot部署中一个斜杠引发的血案--org.thymeleaf.exceptions.TemplateInputException

来源:互联网 发布:录视频软件下载 编辑:程序博客网 时间:2024/05/14 08:32

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

严重: Servlet.service() for servlet [dispatcherServlet] in context with path []threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/emailInfoManager/emailInfoList", template might not exist or might not be accessible by any of the configured Template Resolvers] with root causeorg.thymeleaf.exceptions.TemplateInputException: Error resolving template "/emailInfoManager/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";这行代码,去掉最前面的"/"就好了!

阅读全文
0 0