本地启动正常,发布至服务器报错 :template might not exist or might not be accessible by any of the configured Templa
最近使用thymeleaf,本地启动可以正常访问,发布至服务器后报错org.thymeleaf.exceptions.TemplateInputException: Error resolving template [imgOcrBack/OcrCorpusTask], template might not exist or might not be accessible by anyof the
·
最近使用thymeleaf,本地启动可以正常访问,发布至服务器后报错
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [imgOcrBack/OcrCorpusTask], template might not exist or might not be accessible by any
of the configured Template Resolvers。
先上结论,检查下controller层返回的template地址,与实际xxx.html文件的大小写或名称是否拼写正确。
返回查找错误原因的过程
报错中可以看到 [imgOcrBack/OcrCorpusTask]是我的html文件访问路径
也就是controller层mapping方法返回的值
@Controller
@RequestMapping("/ocrCorpusTask")
public class ImgOcrCorpusController {
@RequestMapping(value = "/index")
public String index(Model model) {
return "imgOcrBack/OcrCorpusTask";
}
}
但是我的html文件名称,确是ocrCorpusTask.html,发现了么,就是首字母大小写不对。这种在我的项目里,本地可以找到,服务器上就报错,不知道是不是项目中有额外配置。
因为对thymeleaf不是很感兴趣,就不深究了,问题解决就好…欢迎有懂的大佬反馈原因
更多推荐
已为社区贡献1条内容
所有评论(0)