tomcat配置映射路径404不生效问题速记
配置方法
##tomcat->conf->server.xml
<Host><Context docBase="D:/images" path="/img"/></Host>
## docBase 为物理路径 path 为需要映射到打开的路径
目前遇到共三个问题 (记得重新启动tomcat)
1. path与docBase路径名称不能一致
这个问题没有试,网上都说名称不可以,所以后续待验证,这里列出
2. 同级目录下web.xml 修改
<!--false 变为true -->
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
3. 以上都试过了且是使用idea启动项目无反应
打开编辑页面,将图片位置勾选上,重新启动
找了下官方的原文
The Tomcat configuration files, among other things, may list the applications that should be deployed at the server start. If this check box is selected,all the applications so listed will be deployed on the server in addition to the artifacts specified on the Deployment tab. If the check box is notselected, only the artifacts and the external resources specified onthe Deployment tab will be deployed.
配置文件可能会列出应该在服务器启动时部署的应用程序。 如果选中此复选框,则除了在“部署”选项卡上指定的构件外,还将在服务器上部署如此列出的所有应用程序。如果未选中该复选框 则仅部署部署选项卡上指定的工件和外部资源。
简单理解下,如果没有勾选,即没有必要去使用则只启动基本的工作和外部资源,以达到减少内存消耗的目的,反之,则启动所有支持的服务程序