Reputation: 1001
I have a basic question,there are two incidents happended while working with Tomcat.
1.I want to share the context between two web applications deployed under same Tomcat container, all I want to do is make crossContext=true in context.xml initally, I did that in {CATALINAHOME}/conf/context.xml didnt worked out. Later I got the solution from our own Stack Overflow then I put the context.xml inside META-INF, everything worked as expected.
2.Similarly when I configure the Data Source for my Web App,I did the same initally then I put the context.xml with required JDBC configurations inside META-INF then it got worked.
So my question is why Tomcat is picking the context.xml configuration's from META-INF? What I'm missing while configuring in {CATALINAHOME}/conf's context.xml ? What I need to understand ?
Need your knowledge and the advice
Upvotes: 1
Views: 370
Reputation: 1108567
Apparently you're working with Tomcat from inside an IDE like Eclipse. This way Tomcat's own /context.xml
will indeed be ignored. The IDE uses just sole the server engine and creates a separate deploy and work space in the IDE environment. In Eclipse, you can find a copy of the /context.xml
in the Servers project. This one is editable and will be applied. But providing another one in webapp's /META-INF
is of course also a solution and it's more portable.
Tomcat's own /context.xml
is only used when you start it standalone by startup.bat/sh
and so on, outside the IDE environment.
Upvotes: 2