我是否需要 context.xml 文件来将 spring webapp 部署到 tomcat
我是 Tomcat 的新手,所以如果这是一个愚蠢的问题,我深表歉意。我创建了一个 spring mvc web 应用程序,当前使用 maven-jetty-plugin 在本地运行。
我可以成功创建 WAR 文件。我想将 WAR 文件部署到 tomcat6 实例中。但是,我不确定是否需要为tomcat创建context.xml文件?如果我这样做,我会将文件放在我的 spring web 应用程序中的哪里?我当前的目录结构如下所示:
src
|
|-main
| |-java
|-resource
| |-META-INF
|-webapp
| |-WEB-INF
|-web.xml
I am new to Tomcat, so I apologize if this is a dumb question. I have created a spring mvc webapp that currently runs locally using the maven-jetty-plugin.
I can successfully create the WAR file. I would like to deploy the WAR file into a tomcat6 instance. However, I am not sure if I need to create a context.xml file for tomcat? And if I do, where would I place the file in my spring webapp? My current directory structure looks like this:
src
|
|-main
| |-java
|-resource
| |-META-INF
|-webapp
| |-WEB-INF
|-web.xml
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
context.xml
文件用于为容器 (tomcat) 配置应用程序特定指令。例如,您可以定义 JNDI 资源、记录器、阀门等。请参阅 Context容器了解更多详细信息。默认情况下,如果您自己没有指定,Tomcat 会自动为您的 war 生成一个默认
context.xml
并将其存储在 /conf/[enginename]/[hostname]/ 中自己的配置文件中[context-root].xml如果您想将其包含在您的 war 中,您可以将其放置在您的 war 中的 /META-INF/context.xml 中。
The
context.xml
file is used to configure application specific instructions for your container (tomcat). For instance, you can define JNDI resources, loggers, valves, etc. See Context Container for more details.By default, Tomcat will auto-generate a default
context.xml
for your war if you do not specify one yourself and store it within its own configuration files in /conf/[enginename]/[hostname]/[context-root].xmlIf you want to include it as part of your war, you can place it in /META-INF/context.xml within your war.
不,你不知道。
context.xml
文件是可选的,Spring 并不要求它。context.xml
用于配置 Tomcat 本身。默认值是合理的,除非有充分的理由,否则无需覆盖它们。No, you don't. The
context.xml
file is optional, and by no means required by Spring.context.xml
is used to configure Tomcat itself. The defaults are sensible, there's no need to override them unless you have a good reason.