Tomcat配置虚拟路径映射失败分析

Tomcat配置虚拟路径映射失败,一定要看这里!
配置Tomcat路径映射
在tomcat安装目录下的conf/server.xml里,在< Host >标签内添加


	    <Context path="/{访问路径}"  docBase="{实际路径}" reloadable="true" crossContext="true">
		Context>

例:


	    <Context path="/local"  docBase="F://dir" reloadable="true" crossContext="true">
		Context>

经试验,路径里的斜杆是正反斜杆都可
盘符后的斜杆可以是单双斜杆
对于F://dir/aa.txt,使用http://localhost:8080/local/dir/aa.txt进行访问
若失败,请检查:

1.在idea运行配置里勾选使用tomcat的配置

Tomcat配置虚拟路径映射失败分析_第1张图片

2.不能从盘符映射

这样是不会成功的(访问不到):


	    <Context path="/local"  docBase="F://" reloadable="true" crossContext="true">
		Context>

这样也不会成功(启动失败):


	    <Context path="/local"  docBase="F:" reloadable="true" crossContext="true">
		Context>

实际路径不能是盘符,只能从目录映射,如F:/dir

附:tomcat启动过程中出现的错误,不影响映射的成功:

19-Dec-2021 12:50:49.445 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [META-INF/MANIFEST.MF] was not loaded as the canonical path [/META-INF/MANIFEST.MF] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.447 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes/META-INF/MANIFEST.MF] was not loaded as the canonical path [/WEB-INF/classes/META-INF/MANIFEST.MF] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.447 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes/META-INF/MANIFEST.MF] was not loaded as the canonical path [/WEB-INF/classes/META-INF/MANIFEST.MF] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.467 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes] was not loaded as the canonical path [/WEB-INF/classes] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.467 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes] was not loaded as the canonical path [/WEB-INF/classes] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.468 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes/logging.properties] was not loaded as the canonical path [/WEB-INF/classes/logging.properties] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.497 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes/META-INF/services/javax.xml.parsers.SAXParserFactory] was not loaded as the canonical path [/WEB-INF/classes/META-INF/services/javax.xml.parsers.SAXParserFactory] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.498 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes/META-INF/services/javax.xml.parsers.SAXParserFactory] was not loaded as the canonical path [/WEB-INF/classes/META-INF/services/javax.xml.parsers.SAXParserFactory] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.574 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/web.xml] was not loaded as the canonical path [/WEB-INF/web.xml] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.585 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes] was not loaded as the canonical path [/WEB-INF/classes] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.599 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer] was not loaded as the canonical path [/WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer] did not match. Use of symlinks is one possible cause.
19-Dec-2021 12:50:49.599 警告 [localhost-startStop-1] org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/local] at path [WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer] was not loaded as the canonical path [/WEB-INF/classes/META-INF/services/javax.servlet.ServletContainerInitializer] did not match. Use of symlinks is one possible cause.

你可能感兴趣的:(web,tomcat,intellij-idea,java)