你應該把
<Context configFile="webapps\jsf-demo-jack.xml" cookies="true" crossContext="false" debug="0" displayName="JSFNews" docBase="../jsf/samples/jsf-demo-jack/web" >
<Logger className="org.apache.catalina.logger.FileLogger" debug="0" directory="logs" prefix="jsf-demo-jack_log." suffix=".txt" timestamp="true" verbosity="1"/>
</Context>
加到
tomcat_home/conf/server.xml

位置:
</host>
之前

解决方案 »

  1.   

    放到conf\Catalina\localhost\目录下,是没错啦,
    但是你得xml文件写得有些问题。参照下面的例子,myweb.xml
    <Context path="/myweb" docBase="myweb"
            debug="0" privileged="true">
    </Context>把myweb目录放到webapps
    访问http://localhost:8080/myweb
      

  2.   

    <Introduction >
    The deployer, which as its name imply, allows deploying and undeploying web applications to the Tomcat server, either statically (the application is setup before the server is started), or dynamically (in conjunction with the Tomcat Manager web application or manipulating already deployed applications). 
     
    <Context descriptors >
    A Context XML descriptor is a fragment of XML data which contains a valid Context element which would normally be found in the main server configuration file (conf/server.xml), and allows easy and automated manipulation of web applications by the various management tools available in Tomcat. For a given host, the Context descriptors are located in $CATALINA_HOME/conf/[enginename]/[hostname]/foo.xml. Note that while the name of the file is not tied to the webapp name, Tomcat will create Context descriptors which match the webapp name whenever it will generate a Context descriptor. Context descriptors allow defining all aspects and configuration parameters of a Context, such as namign resources and session manager configuration. It should be noted that the docBase specified in the Context element can refer to either the .WAR or the directory which will be created when the .WAR is expanded or the .WAR itself.
     
    <Deploying on Tomcat startup >
    The webapps which are present in the host appBase will be deployed if the host "deployOnStartup" property is true. The deployment process is the following: The Context XML declarations will be deployed first 
    Expanded web applications not referenced by Context XML declarations will then be deployed; if they have an associated .WAR file and it is newer than the expanded web application, the expanded directory will be removed and the webapp will be redeployed from the .WAR 
    .WAR files will be deployed 
    For each deployed web application, a matching Context XML descriptor will be created unless one exists already. 
     
    <Deploying on a running Tomcat server >
    If the host "autoDeploy" property is true, the host will attempt to deploy and update web applications dynamically, as needed. The host will need to have background processing enabled for automatic reloading to work, which is the default.This includes: Deployment of WARs which are copied to the host appBase. 
    Deployment of expanded web applications which are copied to the host appBase. 
    Redeployment of a web application which has been deployed from a WAR when the WAR is updated: the expanded web application is removed, and the WAR is expanded again. This will not happen if the host is configured so that WARs are not expanded, in which case the webapp will be simply redeployed. 
    Redeployment of the web application if the /WEB-INF/web.xml file is updated. 
    Redeployment of the web application if the context XML file from which the web application has been deployed is updated. 
    Redeployment of the web application if a context XML file (with a name corresponding to the context path of the previously deployed application) is added in the $CATALINA_HOME/conf/[enginename]/[hostname]/ folder. 
    Note: Web application reloading can also be configured in the loader, in which case loaded classes will be tracked for changes. 呵呵
     
      

  3.   

    tomcat 安装好之后,只需要把你的程序包放到$Tomcat_Home$/webapps下就可以直接使用了。
    这样会使webapps越来越大就需要设置虚拟目录:
    1.单个应用设置:
     在<Host>和</host>之间加上
     <Context path="/site" docBase="d:\site" reloadable="true" debug="0">
     </Context>
     参数:path 表示在浏览器中输入http://localhost:8080/site
         docBase表示你的程序包的物理绝对路径,默认的绝对路径是$Tomcat_Home$/webapps
     这样设定了之后会在$tomcat_home$/conf/catalina/localhost目录下生成一个site.xml文件,此文件的内容就是刚才设置的内容。
    2.通过前面我们知道了在$tomcat_home$/conf/catalina/localhost目录下会生成相应的配置文件,因此我们可以直接在$tomcat_home$/conf/catalina/localhost目录下写配置文件文件名任意取,最好是跟你的web应用相同便于管理,如site.xml内容同上
    <Context path="/site" docBase="d:\site" reloadable="true" debug="0">
     </Context>
    3.更改整个根目录:
      找到<Host name="localhost" debug="0" appBase="webapps" 
      unpackWARs="true" autoDeploy="true">
     将appBase的设置成期望的路径(绝对路径)
     出现的问题:输入:http://localhost:8080/没有出现默认的页面
     原因当然是更改了路径造成的。解决也很简单了,把文件拷过来,或者再把原来默认的设成虚拟路径。
      

  4.   

    关注,可是我的TOMCAT5.0.19是自动安装的,按照上面的方法去做,就是不行,感觉5.0.19怎么还没有4.1版本的方便易用呢?