0
votes

(Tomcat discussed here is an in-Liferay embedded 7.0.42.)

For WARs that come with no META-INF\context.xml Tomcat supplies its own. Hence whenever I re-deploy such app this file also gets (re)written. Unfortunately the default version of META-INF/context.xml does not suit my (debugging) needs.

Where does Tomcat store the default version of META-INF\context.xml?

Possibly an alternate solution?
I also tried to place my own context.xml here, so Tomcat does not supply its own:

%TOMCAT%\conf\Catalina\localhost\mywebapp.xml

...without any apparent effect; context.xml in webapps\my-web-app\META-INF\context.xml still gets (over)written with Tomcat's own.

(Modifying the WAR itself is not desirable.)

1
"For WARs that come with no META-INF\context.xml Tomcat supplies its own." Where do you get this information? Citation please. And where does it say that it's stored anywhere?user207421
I am witnessing it. I deploy a WAR without it, when Tomcat unpacks the WAR it now has META-INF/context.xml. At first I suspected it is the Liferay doing it, but I couldn't find anything in its files. Now when you are asking this defensively it makes me rethink... Maybe it's Liferay doing it after all.Jaroslav Záruba
OK, so we can accept that it's Tomcat that's doing it, but you've found where it's stored; so what's the question?user207421
Well, I haven't. :( And since I asked this question I went through some posts mentioning that older versions of Liferay (not mine) were overwriting this file even when it was present in the WAR. So in the end you might have been right that it is not Tomcat but Liferay who supplies the file. Still looking into it. Maybe I should re-phrase my question, rename it or just delete and ask again. (I failed when trying to find out where Liferay gets its default context.xml.)Jaroslav Záruba
Liferay does not have any stakes in tomcat's context.xml that I'm aware of. You might want to inject your own META-INF/context.xml before you deploy the webapp to Liferay (or tomcat) in order to keep it. Also, you can make Liferay deploy to a different directory than webapps and point to that directory from your own conf/Catalina/localhost/whatever.xmlOlaf Kock

1 Answers

0
votes

This is how one can supply one's own context.xml ad-hoc, during the build (i.e. w/o modifying the sources) and thus avoid Tomcat adding its own:
mvn install ... -Dmaven.war.containerConfigXML=src/main/resources/context.xml