How to specify path in META-INF/context.xml for Tomcat

前端 未结 4 1956
-上瘾入骨i
-上瘾入骨i 2021-02-05 14:05

I\'m using Tomcat 7 and would like to set the context root of a war file in the war file itself and have Tomcat autodeploy and pick up this path. I thought I found the way to

4条回答
  •  日久生厌
    2021-02-05 14:58

    The Context path attribute is ignored unless the path is specified in a hard-coded Context in server.xml, which is strongly discouraged, and doesn't take multilevel paths.

    The name of the war file, or the name of the Context xml file in tomcat/conf/Catalina/hostname becomes the path of the deployed application.

    In your case the latter of the two above is the solution, just make sure you put the .war file outside of the designated appBase for the Host, or you'll deploy the app twice.

    In: conf/Catalina/localhost/myapp#path.xml

    
    
    
    

提交回复
热议问题