tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Busque <>
Subject Re: Context PreResources configuration question
Date Thu, 03 Mar 2016 17:08:31 GMT

The Wed, 02 Mar 2016 22:29:35, Mark Thomas wrote :

That was pretty much a perfect question. A clear problem statement. A
clear description of what you expected to happen vs. what actually
happened. A clear description of what you tried. If only all posts to
the users list were like this.

This is an easy fix. The problem is that with no docBase defined and a
path of "", tomcat is going to use a docBase of "ROOT". That means
Tomcat is going to look for these files in "work/example1/ROOT" not in

Generally, I'd recommend a slightly different directory structure.
Something like:
which auto expands into


Thank you. I know how it is when someone stop at your desk for help, but not giving you any
details on what the problem is :)

I followed your advices. I created separated webapps under our ${catalina.base} folder webapps-example1,
webapps-example2 and so on, with a ROOT.war in each of them (what we usually do with single
webapps deployment).

It work... partially. I'm getting random crash with the same error as when it couldn't find
the libraries.

org.apache.jasper.JasperException: The absolute uri: <> cannot be resolved in either web.xml or the jar files deployed
with this application

I first thought it was browser cache, but after testing a few time with wget on Tomcat itself
and still getting the error, I have the feeling I'm hitting a cache inside tomcat. Why it's
random, I have no clue.

Next I tried the docBase approach I totally forgot about that setting  after we removed them
when they got a behaviour change midway in Tomcat 7 and it was recommended not to used them.

With webapps-example1 and webapps-example2, everything and a configured docBase, everything
worked. Multiple refresh did not cause random class not found without the docBase.  However,
since I have a dozen webapps, leaving 12 extra webapps folders under ${catalina.base} fell
 a bit cumbersome.

So I tried again with the following directory structure :

It worked like a charm too, but I noticed something that may be a priority order issues between
ContextConfig and HostConfig.

With this configuration:

    <Host name="<>" appBase="webapps/example1"
unpackWARs="true" autoDeploy="false">
          <Context path="" reloadable="false" workDir="work/sourcesuite" docBase="/home/tomcat/wars/example1.war">
              <JarScanner scanClassPath="false" scanBootstrapClassPath="false"/>
                  <PreResources className="org.apache.catalina.webresources.DirResourceSet"
 readOnly="true" webAppMount="/"
                  base="/home/tomcat/CMS/" />

if I create ${catalina.base}/webapps and none of it's host appBase, I get the following error:

Mar 03, 2016 11:19:07 AM org.apache.catalina.startup.ContextConfig beforeStart
SEVERE: Exception fixing docBase for context [] Unable to create the directory [/vol0/home/cda/servers/CDA1/webapps/mediagrif/ROOT]
        at org.apache.catalina.startup.ExpandWar.expand(
        at org.apache.catalina.startup.ContextConfig.fixDocBase(
        at org.apache.catalina.startup.ContextConfig.beforeStart(
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(
        at org.apache.catalina.util.LifecycleBase.setStateInternal(
        at org.apache.catalina.util.LifecycleBase.start(
        at org.apache.catalina.core.ContainerBase$
        at org.apache.catalina.core.ContainerBase$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$

        // Create the new document base directory
        if(!docBase.mkdir() && !docBase.isDirectory()) {
            throw new IOException(sm.getString("expandWar.createFailed", docBase));


The source reveal that ExpandWar try to do a mkdir but not a mkdirs  . Since the parent is
absent, it fail and crash.

BUT, some moment later, the HostConfig class is creating those exact parents, recursively.

        if (host.getCreateDirs()) {
            File[] dirs = new File[] {host.getAppBaseFile(),host.getConfigBaseFile()};
            for (int i=0; i<dirs.length; i++) {
                if (!dirs[i].mkdirs() && !dirs[i].isDirectory()) {

        at org.apache.catalina.startup.HostConfig.start(
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(
        at org.apache.catalina.util.LifecycleBase.setStateInternal(
        - locked <0xa00e6120> (a org.apache.catalina.core.StandardHost)
        at org.apache.catalina.util.LifecycleBase.setState(
        - locked <0xa00e6120> (a org.apache.catalina.core.StandardHost)
        at org.apache.catalina.core.ContainerBase.startInternal(
        - locked <0xa00e6120> (a org.apache.catalina.core.StandardHost)
        at org.apache.catalina.core.StandardHost.startInternal(
        - locked <0xa00e6120> (a org.apache.catalina.core.StandardHost)
        at org.apache.catalina.util.LifecycleBase.start(
        - locked <0xa00e6120> (a org.apache.catalina.core.StandardHost)
        at org.apache.catalina.core.ContainerBase$
        at org.apache.catalina.core.ContainerBase$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$


Is it normal that the context is initialized BEFORE the host is started, while expecting the
host to create the structure, but failing because the structure is not present?

Should the expand be executed after the host created the proper structure for the context
to expand it wars?


Philippe Busque
1111, rue St-Charles Ouest,
Tour Est, bureau 255
Longueuil (Québec) Canada J4K 5G4
Tél. : 450-449-0102 ext. 3017
Télec. : 450-449-8725

Ce message et les fichiers d’accompagnement transmis avec celui-ci s’adressent expressément
au(x) destinataire(s) et peuvent contenir des renseignements confidentiels et privilégiés.
Si vous recevez ce message par erreur, veuillez en aviser immédiatement l’expéditeur par
courrier électronique. Veuillez également ne pas en prendre connaissance et en supprimer
toutes les copies immédiatement. Technologies Interactives Mediagrif Inc. et ses filiales
n’acceptent aucune responsabilité à l’égard des opinions exprimées dans le message
ou des conséquences de tout virus informatique qui pourrait être transmis avec ce message.
Ce message fait également l’objet d’un copyright. Il est interdit d’en reproduire,
adapter ou transmettre quelque partie que ce soit sans le consentement écrit du détenteur
du copyright.

This email and any files transmitted with it are solely intended for the use of the addressee(s)
and may contain information that is confidential and privileged. If you receive this email
in error, please advise us by return email immediately. Please also disregard the contents
of the email, delete it and destroy any copies immediately. Mediagrif Interactive Technologies
Inc. and its subsidiaries do not accept liability for the views expressed in the email or
for the consequences of any computer viruses that may be transmitted with this email. This
email is also subject to copyright. No part of it should be reproduced, adapted or transmitted
without the written consent of the copyright owner.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message