Issue
On my dev machine (running Windows 10
) I'm using Tomcat 9
to develop and test a web app.
Since the app needs a connection string that I don't want to include in the app's WAR package, I've put it in a context XML file and saved that file to tomcat/conf/Catalina/localhost/<war_name>.xml
, as suggested in the official documentation. This works perfectly under Windows.
Now I'm trying to deploy to a production machine, which is running Linux Debian 10
. I've installed the same version of Tomcat and put the context file in the same location, but this time it's not working: the context file is not recognized and the app fails to start because it doesn't find the required connection string. To make it work, I had to put the context file in /tomcat/webapps/<war_name>/WEB-INF/context.xml
. This works, but it's very annoying because in that location it gets deleted every time the app is redeployed, so every time I redeploy I have to copy it over.
Is there a reason why this is working on Windows and not on Linux? Why is this happening?
Solution
Well... after further testing, turns out that it IS reading the context file, but for some reason it doesn't straight away. I have to wait a couple of minutes and the start the webapp manually from the manager console... strange
Answered By - Master_T