You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Paul <pg...@gmail.com> on 2020/08/31 09:36:51 UTC

Implications of setting createDirs attribute on host declarations to false in Tomcat

Hello,

When running Tomcat in a Docker container as non-root, I'm getting an 
error entry in the logs:

Unable to create directory for deployment: 
[/usr/local/tomcat/conf/Catalina/localhost]
I traced this down to the aforementioned directory not being there when 
Tomcat gets launched and the user running Tomcat does not having the 
permissions to create the directory.

I also traced where this error message is coming from and its due to the 
createDirs attribute on the host declaration in server.xml not being set 
to false. The docs for the createDirs property states that if its set to 
true (the default) it'll attempt to create some directories, log an 
error when it fails, but the failure wont stop the startup of Tomcat.

But what I cannot find anywhere is why those directories are created in 
the first place and what the ramifications are of them not being created 
when createDirs is set to false.

This question is for Tomcat docker images in general (in order to 
determine whether generic Tomcat Docker images should do something 
different to prevent these Errors in the logs), in my specific scenario 
however I'm running one webapp: an exploded WAR in the webapps/ROOT 
directory, which comes with its on context.xml in 
/webapps/ROOT/META-INF/context.xml

TIA

Paul



-- 
This email has been checked for viruses by AVG.
https://www.avg.com

Re: Implications of setting createDirs attribute on host declarations to false in Tomcat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Paul,

On 8/31/20 05:36, Paul wrote:
> Hello,
>
> When running Tomcat in a Docker container as non-root, I'm getting
> an error entry in the logs:
>
> Unable to create directory for deployment:
> [/usr/local/tomcat/conf/Catalina/localhost] I traced this down to
> the aforementioned directory not being there when Tomcat gets
> launched and the user running Tomcat does not having the
> permissions to create the directory.
>
> I also traced where this error message is coming from and its due
> to the createDirs attribute on the host declaration in server.xml
> not being set to false. The docs for the createDirs property states
> that if its set to true (the default) it'll attempt to create some
> directories, log an error when it fails, but the failure wont stop
> the startup of Tomcat.
>
> But what I cannot find anywhere is why those directories are
> created in the first place and what the ramifications are of them
> not being created when createDirs is set to false.

You are deploying a WAR file, right?

If you don't set createDirs="true" then Tomcat will not be able to
unpack WAR files for you.

> This question is for Tomcat docker images in general (in order to
> determine whether generic Tomcat Docker images should do something
> different to prevent these Errors in the logs), in my specific
> scenario however I'm running one webapp: an exploded WAR in the
> webapps/ROOT directory, which comes with its on context.xml in
> /webapps/ROOT/META-INF/context.xml

If webapps/ already exists, what directory is Tomcat trying to create?
conf/[engine]/[host]?

Can you arrange for conf/[engine]/[host] (usually
conf/Catalina/localhost) to exist so that the setting for createDirs
doesn't matter?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl9NFjoACgkQHPApP6U8
pFi/7xAAs6Rg39EWDFLkL2DutF4sGu6MeB9lwaRxq/OmsubS5X44+w+kFGha05fx
wHYFe6vhl6WL+UEIo/bja+JRgQCTCDTYf6fMmPYvJ6am/b2Ew0GmtjQlU6eimH2y
uGM/sfT0No+FYRpAxW9mbsh86H6rYMBNvj+dNWeusSkS/3uX2cELm/WwDKnOQb9I
bX5ZxgsA2DlXP37Zn+Q3G1bjP71Wbx1C/pbiXCYL3tGq3RLalBY3Y++GoTjAtEkX
4/jBNqLGBwgmFKQY0pfEc9iNCgwbgMh85zAvvUkzIxt+oKxYQLWPDwjs5Krfu2ZK
/pUIFey33rqAO9Vo2iuyX8W03kU0hhAK0PIXimPW8H3848o4Qe+5mJt46jrcpAb7
DFGZUiwS7plD9UrTZpY4UGfWtwAx1GwD9Db/l50Ru32mVtbYgvfzYKqKfZKe7hbI
gOUjIu+5jk0cgUE8d+bK2kiTnX5CQJNHT2N44y1/HLRBtuS7RX5e7yLuQfLZ6yeI
YpmQAr5oxccQ4XSbL9XQMtckG46JqSL1GwbejMT4n0pMzj7zI8J2Eeh3hCsov5bL
trDml0upYcWFoLNUJhFn+Lo1a0ujqOlH2iKS0xg+RU37t0mH0U8/ys77ZS12cnk8
bbwztsxUVPHKc2VjKOMhn47v+cmeGhAP6zeB2ZZ7O9fv3Si9xOQ=
=g5QV
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org