TransWikia.com

Where should I set context path for Tomcat?

Server Fault Asked on November 7, 2021

My regular question about Tomcat. Tomcat docs about <Context>.

It is NOT recommended to place elements directly in the
server.xml file.

But

This attribute must only be used when statically defining a Context in
server.xml. In all other circumstances, the path will be inferred from
the filenames used for either the .xml context file or the docBase.

Even when statically defining a Context in server.xml, this attribute
must not be set unless either the docBase is not located under the
Host’s appBase or both deployOnStartup and autoDeploy are false. If
this rule is not followed, double deployment is likely to result.

Questions:

1) Where should I set my context path (Without ROOT.war and ROOT.xml) (I must in server.xml, but it is not recommended)

2) What is double deployment and when do it happen?

3) If I set my context path to "" and if I set docBase in /opt/tomcat/conf/Catalina/mysite.dom/mysite.xml in catalina.out is next entries:

17-Aug-2018 10:24:25.883 WARNING [main] org.apache.catalina.startup.HostConfig.deployDescriptor The path attribute with value [] in deployment descriptor [/opt/tomcat/conf/Catalina/mp.org/mp.xml] has been ignored
17-Aug-2018 10:24:25.890 WARNING [main] org.apache.catalina.startup.HostConfig.deployDescriptor A docBase [/var/www/ModularPlatform/target/web/mp] inside the host appBase has been specified, and will be ignored

But I can adress by this path – it is work.

3.1 Why do it work?

3.2 Why do tomcat trying to ignoring this?

4) Also in catalina.out is next entrie too:

17-Aug-2018 10:24:26.047 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/var/www/mysite/target/web/ROOT]

Why do tomcat create the ROOT directory?

I have Tomcat 9.0.10.

Thank you for patience.

P.S. Sorry for my english.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP