简体   繁体   English

在tomcat中使用上下文条目运行Web应用程序

[英]run web application with context entry in tomcat

I have tomcat which successfully running web application with just making following entry into conf/server.xml file. 我有tomcat,只需在conf/server.xml文件中输入以下内容即可成功运行Web应用程序。

<Host name="test" debug="0" appBase="full path of jsp and java classes"
                unpackWARs="false" autoDeploy="false">

                <Logger className="org.apache.catalina.logger.FileLogger"
                    prefix="om_log." suffix=".log"
                    timestamp="true"/>

        <Context path="" docBase="full path of jsp and java classes"
               reloadable="false" crossContext="false" />
    </Host>

But i am not able to run same thing in newly downloaded tomcat. 但是我不能在新下载的tomcat中运行相同的东西。

Cal i know the step to run application with context entry ? 我知道用上下文输入运行应用程序的步骤吗?

Taken from Context docs on Tomcat website 取自Tomcat网站上的Context文档

Defining a context It is NOT recommended to place <Context> elements directly in the server.xml file. 定义上下文不建议将<Context>元素直接放置在server.xml文件中。 This is because it makes modifying the Context configuration more invasive since the main conf/server.xml file cannot be reloaded without restarting Tomcat. 这是因为它使修改Context配置更具侵入性,因为如果不重新启动Tomcat就无法重新加载主conf/server.xml文件。

Individual Context elements may be explicitly defined: 各个上下文元素可以明确定义:

  1. In an individual file at /META-INF/context.xml inside the application files. 在应用程序文件内/META-INF/context.xml的单个文件中。 Optionally (based on the Host's copyXML attribute) this may be copied to $CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to application's base file name plus a ".xml" extension. (可选)(基于主机的copyXML属性),可以将其复制到$CATALINA_BASE/conf/[enginename]/[hostname]/并重命名为应用程序的基本文件名加上“ .xml”扩展名。
  2. In individual files (with a ".xml" extension) in the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory. $CATALINA_BASE/conf/[enginename]/[hostname]/目录中的单个文件中(带有“ .xml”扩展名)。 The context path and version will be derived from the base name of the file (the file name less the .xml extension). 上下文路径和版本将从文件的基本名称(文件名减去.xml扩展名)派生。 This file will always take precedence over any context.xml file packaged in the web application's META-INF directory. 该文件将始终优先于Web应用程序的META-INF目录中打包的任何context.xml文件。
  3. Inside a Host element in the main conf/server.xml . 在主conf/server.xmlHost元素内。

Without knowing exactly what error you get, it's hard to help any more than this. 如果不确切知道您遇到什么错误,那么很难提供更多帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM