context.xml vs ROOT.xml
I'm wanting to configure a database connection. I've got my configurations stored in the META-INF/context.xml file, but because I'm not deploying my application as a WAR, the context.xml is ignored. I can copy my application's context.xml and place it in the tomcat/conf/context.xml and it works. I can also place the database connection in the tomcat/conf/Catalina/localhost/ROOT.xml and it works. My question is, which one should I be using? I see examples of both types of configuration files. With some of the off-the-shelf applications we use, I see it in the ROOT.xml. But I'm reading a lot where people are using the context.xml. I'm using Tomcat7 and really can't find anything that says one file is better than the other. The only thing it looks like is that the ROOT.xml is strictly for that particular application container, whereas the context.xml seems more global. If I'm only running one application, does it really matter? I've got it working in either case, just more-less curious. -JA- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: context.xml vs ROOT.xml
From: Jason Aleski [mailto:jason.ale...@gmail.com] Subject: context.xml vs ROOT.xml I've got my configurations stored in the META-INF/context.xml file, but because I'm not deploying my application as a WAR, the context.xml is ignored. Why do you think it's ignored? I can copy my application's context.xml and place it in the tomcat/conf/context.xml and it works. And is exposed to _all_ of your webapps, since conf/context.xml is implicitly included in every webapp. I can also place the database connection in the tomcat/conf/Catalina/localhost/ROOT.xml and it works. Which is where it belongs, when it's supposed to apply to the default webapp only. If I'm only running one application, does it really matter? Are you really running only one application? Have you actually removed all of the others that come with Tomcat, including the manager? Think about what happens when you decide to install a second webapp; best practice dictates that you not have to modify the global config to do so. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: context.xml vs ROOT.xml
Chuck, Thank you for your feedback. I'll reply in order. 1) I believe it is being ignored because it doesn't see the database connection when it is in the META-INF/context.xml. It does see them when I copy the configurations to the other files. What I read and understand is the META-INF/context.xml file is used only when the application is deployed via a WAR file. Have I missed something? 2) Yes, I did remove the default Tomcat applications. This is the only app I have. 3) Yea, I want to avoid editing the global config. That is why I was hoping the META-INF method would work. I guess I will stay with placing the configurations in the ROOT.XML. -JA- On 4/30/2013 1:16 PM, Caldarale, Charles R wrote: From: Jason Aleski [mailto:jason.ale...@gmail.com] Subject: context.xml vs ROOT.xml I've got my configurations stored in the META-INF/context.xml file, but because I'm not deploying my application as a WAR, the context.xml is ignored. Why do you think it's ignored? I can copy my application's context.xml and place it in the tomcat/conf/context.xml and it works. And is exposed to _all_ of your webapps, since conf/context.xml is implicitly included in every webapp. I can also place the database connection in the tomcat/conf/Catalina/localhost/ROOT.xml and it works. Which is where it belongs, when it's supposed to apply to the default webapp only. If I'm only running one application, does it really matter? Are you really running only one application? Have you actually removed all of the others that come with Tomcat, including the manager? Think about what happens when you decide to install a second webapp; best practice dictates that you not have to modify the global config to do so. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: context.xml vs ROOT.xml
From: Jason Aleski [mailto:jason.ale...@gmail.com] Subject: Re: context.xml vs ROOT.xml Don't top post. I believe it is being ignored because it doesn't see the database connection when it is in the META-INF/context.xml. I believe you must be doing something else that's causing the DB connection to go missing. If you look at a standard Tomcat download, you'll see that the manager and host-manager webapps are included as unpacked directories, including META-INF/context.xml files; if those were being ignored, those webapps could not function. Note that if you have a ROOT.xml file in conf/Catalina/[host], that will override what's in webapps/ROOT/META-INF/context.xml. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org