Blank Web contexts (hundreds)

Stack info:
OS: CentOS 8
JVM: built in jre: 11.0.11
Tomcat Version: built in 9.0.46
Lucee Version:

I am running mod_cfml with nginx reverse proxy.
There is only ONE vhost in nginx with reverse proxy, and it is not the nginx default_server (disabled).
It’s explicitly a server_name

mod_cfml.core in tomcat/conf/server.xml has been configured properly with sharedkey.
I have modified the /tomcat/conf/web.xml section for lucee-web-directory to specify a specific folder: /var/lucee/tomcat/webapps/.

Thus, as soon as I load webpage over nginx, it produces the web context automatically in that folder.
This works fine - the site loads fine.

The problem is that lucee is also apparently creating hundreds of other web contexts which have no valid domain.
Under I can see them listed at the bottom, tons of them with randomly generated hash names.

How do I stop that??

/var/log/nginx/access.log is empty of anything except the request I made to my own nginx website.
And /var/log/lucee/catalina.out (i made a symlink to tomcat logs folder) contains tons of entries stating: Deployment of web application directory [/var/lucee/tomcat/webapps/3355b5ff8181cdc8beb298481edc0769] has finished
And /var/log/ucee/localhost_access.log lacks any entries.

What is creating all these blank contexts??

Hi @ensemblebd and welcome!

This is very likely because of your web.xml changes. This is what’s possibly happening:

You’ve set your web-context directory to point to “webapps” in the web.xml. This directory is probably also your “appBase” as specified in the host entry of your server.xml. On startup Tomcat will create the web-inf folders (as a hashed name) and place them into that webapps directory. Because webapps is also your appBase, Tomcat will identify each of these newly created hashed directories as a seperate new “web app” and create a seperate web contexts folder for those too. In other terms: your setting is making Tomcat recursively create a new web context directory for each new web context directory. It’s an infinite loop.

This should be the solution for you:
Create a new empty directory in a location “outside” (e.g. at “/srv/lucee-web-contexts/” or “/var/lucee/config/web/”) and point your /tomcat/conf/web.xml section lucee-web-directory to it with “/srv/lucee-web-contexts/{web-context-label}” or "/var/lucee/config/web/{web-context-label}. This directory needs to have write permissions for the user running Lucee.

If it’s not the issue above, you’ll probablly have an issue of nested contexts.

1 Like

You are 100% spot on!!! Thank you very much!
I feel like a bit of a buffoon for that, seems so obvious now. I knew I was playing with fire putting it there, but figured I’d just “repurpose” it since no [ROOT] will be in use (technically it still is). Fatal choice.

Confirmed fix by moving that target directory for WEB-INF’s.

1 Like

@ensemblebd I’m glad it woked!!!

You absolutely don’t need to feel like that. I think that is a very common pitfall when you are new to tomcat. There is a common problem in understanding the difference between the appBase vs docRoot. I’ve been there too and that was when I’ve started digging a little into Tomcat and all the definitions and differences. Today I understand it, but it needed some time. It’s not intuitive at all.

But for that kind of problems you’ll always find somebody here around to help out.

Welcome to our growing community and happy coding with Lucee.