Note that there are some explanatory texts on larger screens.

plurals
  1. PORelative path in Context.xml
    primarykey
    data
    text
    <p>Is there a way to set a relative path to the <strong>docBase</strong> attribute in the context.xml of a web application, so it is outside of the appBase directory of the tomcat server instance?</p> <p>I would like to be able to share the context configuration between computers and have the app living in a directory, not a war file. That way i can compile the classes directly into that directory (in my project development directory) and have tomcat use these classes without any copying/packaging needed.</p> <p>I am using the tomcat 8.0.0-RC5. My directory Layout is:</p> <pre><code>/home/david/projects/frontend/web-content &lt;-- the static html files /home/david/projects/frontend/web-content/WEB-INF &lt;-- the WEB-INF with the web.xml /home/david/projects/tomcat &lt;-- tomcat base directory /home/david/projects/tomcat/Catalina/localhost &lt;-- holds the frontend.xml context configuration </code></pre> <p>I have tried </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Context path="/frontend" docBase="../../frontend/web-content"&gt; &lt;/Context&gt; </code></pre> <p>but that did not work. The whole path before /web-content seems to be ignored. The log says:</p> <pre><code>The main resource set specified [/home/david/projects/tomcat/webapps/web-content] is not valid </code></pre> <p>The <a href="http://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Common_Attributes" rel="noreferrer">Tomcat 8 documentation</a> for the context container says:</p> <blockquote> <p>You may specify an absolute pathname for this directory or WAR file, or a pathname that is relative to the appBase directory of the owning Host.</p> </blockquote> <p>Does relative here mean a strict subdirectory of appBase (no .. allowed)?</p> <p>Setting an absolute path works without problems. The configuration</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Context path="/frontend" docBase="/home/david/projects/frontend/web-content"&gt; &lt;/Context&gt; </code></pre> <p>works, but it is specific to my computer. So I cannot share the context configuration without modification anymore.</p> <p>I could create a symbolic link inside the appBase directory of the tomcat server and let it point to the web-content folder of my application. This would work, but I would have different configurations (symbolic links) on linux and windows machines.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload