server.xml 中定义的 tomcat 上下文未加载 [英] tomcat context defined in server.xml is not loading
问题描述
我在路径上部署了一个 Web 应用程序
/var/lib/tomcat6/webapps/abc/
在路径 /etc/tomcat/server.xml
上的 server.xml
中,我添加了以下几行.
在主机标签内.
当我重新启动 tomcat 并点击 http://localhost:8080/
什么都没有出现但是当我输入 http://localhost:8080/abc
主页是显示,这意味着 server.xml
中的上述条目未生效.
我做错了什么??
看起来您想将 webapp abc
设置为默认 Web 应用程序(即通过 http://localhost:8080/),然后在 Context 中指定路径为
""
而不是 "/"
来自 Tomcat 文档,
<块引用>如果您指定一个上下文路径空字符串 (""),您正在定义为此的默认 Web 应用程序主机,它将处理所有请求未分配给其他上下文
I have a web application deployed on path
/var/lib/tomcat6/webapps/abc/</code>
in server.xml
on path /etc/tomcat/server.xml
I have added following lines.
<Context docBase="/var/lib/tomcat6/webapps/abc/" path="/" reloadable="true"> <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="20" maxIdle="10" maxWait="10000" name="jdbc/abcDB" password="abc" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/abc" username="abc"/> </Context>
inside the host tag.
When I restart tomcat and hit http://localhost:8080/
nothing appears but when I enter http://localhost:8080/abc
home page is displayed which means above entry in server.xml
is not taking affect.
What am I doing wrong ??
Looks like you want to set webapp abc
as the default web app (i.e. access it directly via http://localhost:8080/), then give the path as ""
not "/" in Context
From the Tomcat docs,
If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts
这篇关于server.xml 中定义的 tomcat 上下文未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!