异常现象:在本地打包部署完全没有问题,资源文件也都可以映射上,但是打包成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";
}