SpringBoot项目打包jar后运行报错Error resolving templ ate [XXX], template might not exist

SpringBoot项目在IDEA开发期间运行一切正常,但是打成jar包后运行出现页面访问不了,报如下错误:

2020/07/26-20:42:41 [http-nio-8081-exec-3] ERROR org.thymeleaf.TemplateEngine- [THYMELEAF][http-nio-8081-exec-3] Exception processing template “/i18n/before”: Error resolving templ
ate [/i18n/before], template might not exist or might not be accessible by any of the configured Template Resolvers
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/i18n/before], template might not exist or might not be accessible by any of the configured Template Reso
lvers
at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869)
at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607)
。。。。。。

在这里插入图片描述
解决方案如下:
将"/i18n/first"前面的"/“删掉
在这里插入图片描述
效果如下:
删了”/“后:http://localhost:8081/i18n/first
在这里插入图片描述
没删”/"的:http://localhost:8081/i18n/admin
在这里插入图片描述

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
"Error resolving template [], template might not exist or might not be accessible by any of the configured Template Resolvers" 这句话的意思是无法解析模板,可能是因为模板不存在或不可被任何配置的模板解析器访问。 如果出现这个错误,有几个可能的原因和解决方法。首先,你需要检查是否在项目的正确位置下提供了该模板文件。其次,你需要确保在项目的配置文件中正确配置了模板解析器。比如,在SpringBoot项目中,你可以在application.yml文件中添加thymeleaf的相关配置信息,如指定模板所在的目录、是否进行模板路径检查、是否缓存以及模板的后缀等。 总的来说,该错误提示是告诉你无法找到或访问特定模板文件,你需要检查模板文件的位置和配置文件中的模板解析器配置,以确保模板可以被正确解析和访问。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [解决Error resolving template [x] template might not exist or might not be accessible by any of the ...](https://blog.csdn.net/lvoelife/article/details/126450694)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [Error resolving template [], template might not exist or might not be accessible by any of the conf](https://blog.csdn.net/qq_43377749/article/details/115468087)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值