We have an angular based web application with a bunch of static resources.

The war is present under the "webapps" app base.

Understandably it is NOT right way (and fixed in later deployments), but the 
server.xml has:


<Context path="/ui"> ... </Context>

This caused an issue while deploying and accessing this application on a 
Windows 2019 setup.
I don't have full access to this environment and hence could not do more 
debugging than necessary.

Gemini AI gave a below possible explanation to this very rare problem (there 
were multiple identical setups and none of them seen any issue).


This <Context> tag sits inside a <Host> container where appBase="webapps" and 
it causes Tomcat to get into a race condition:
Auto-Deployer: Tomcat scans the webapps folder, sees a folder named ui, and 
deploys it automatically as a standard web app.
Explicit Deployer: Tomcat reads server.xml, sees your <Context path="/ui"> 
block, and tries to deploy a second application mapped to /ui using an absolute 
path reference.
Because of this conflict, Tomcat splits the application in memory. The initial 
mapping (which handles the 302 redirect) belongs to one deployment instance, 
but when it goes to fetch index.html or test.txt, it looks at the explicit 
server.xml context instance.
Potential cause of this:

Due to differences in disk speed, CPU core scheduling, or security file-locking 
delays (like an EDR agent scanning the files on boot), the server.xml parser 
registers the context first. This breaks the link to the physical webapps 
directory, causing the files to become invisible to the web server.

Does this explanation seem reasonable?

FWIW, the setup has 20 CPUs and also has Trellix Endpoint Security software.

Appreciate any insights into this very odd issue.
We fixed it by removing the Context element from server.xml.

Thanks,
Amit

Reply via email to