Re: Tomcat 5.5. META-INF/context.xml ignored when deploying as war.
Eric Berry wrote: Mark, Chuck, Thank you both very much for the detailed explanations. I can certainly see how this would definitely speed development along, and how - in most cases - the context.xml is unnecessary. I myself, have rarely used them unless as Mark mentioned, I needed specific context parameters. In this case however, I'm using maven 2 to build the war file locally, and maven 2 is appending the version and -SNAPSHOT to the war (as well as the exploded war directory). This simply means that I have to rename the war every time in order to deploy it. I was trying to use the Context/path to remove a little bit of tedium on my part. Not a really big deal, but I would like to ask why the path attribute is ignored - meaning, why originally was the decision made to ignore it in this type of situation? It was part of a re-write of the deployer. There were several aims including: - simplify the code - make behaviour more consistent - make behaviour easier to predict One of the benefits of this change is that the process of determining a context path from a war/dir/context.xml file is much, much simpler. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5. META-INF/context.xml ignored when deploying as war.
Eric Berry wrote: Ok cool. Thank you very much for clearing that up for me. The first time I deployed the war, there wouldn't have been a context in any of the 3 locations mentioned above. As you said, it would have copied the context.xml file from the war into the 3rd location as contextpath.xml correct? Yes, correct. I looked at in $CATALINA_HOME/conf/[enginename]/[hostname]/, and sure enough there is a mywar-snapshot.xml. When I look at the contents of that file it it contains this: [quote] Context path=/mywar / [/quote] So in this case the file-name itself is actually used rather than the path specified in this file? I know you quoted this from the documentation, I just wanted to clarify that this is what it meant. Yes, that is correct. With that context file, you don't actually need one. My understanding aside, this seems a bit counter-intuitive to me. Why recommend the use of the context.xml if it really isn't used? The context.xml is recommended if you need to set other context parameters (eg privileged, DataSources etc). It isn't recommended to always use one. In either case, thank you very much for the help. You're welcome. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 5.5. META-INF/context.xml ignored when deploying as war.
From: Eric Berry [mailto:[EMAIL PROTECTED] Subject: Re: Tomcat 5.5. META-INF/context.xml ignored when deploying as war. (Just expanding a little on what Mark gave you.) Why recommend the use of the context.xml if it really isn't used? It is used - Tomcat copied the context.xml file from your webapp's META-INF directory to conf/Catalina/[host]/[appName].xml during expansion of the .war file. Your particular Context element has no useful content, however. I always had the impression the name of file was used as a default case when a more specific context.xml wasn't present. No, the path attribute is used only when the Context element is in server.xml, which is strongly discouraged. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5. META-INF/context.xml ignored when deploying as war.
Mark, Chuck, Thank you both very much for the detailed explanations. I can certainly see how this would definitely speed development along, and how - in most cases - the context.xml is unnecessary. I myself, have rarely used them unless as Mark mentioned, I needed specific context parameters. In this case however, I'm using maven 2 to build the war file locally, and maven 2 is appending the version and -SNAPSHOT to the war (as well as the exploded war directory). This simply means that I have to rename the war every time in order to deploy it. I was trying to use the Context/path to remove a little bit of tedium on my part. Not a really big deal, but I would like to ask why the path attribute is ignored - meaning, why originally was the decision made to ignore it in this type of situation? Thank you again for all the help. Cheers, Eric -- Learn from the past. Live in the present. Plan for the future. 11101000 http://www.townsfolkdesigns.com/blogs/elberry
Re: Tomcat 5.5. META-INF/context.xml ignored when deploying as war.
Eric Berry wrote: Hello, I'm trying to use the manager to deploy a war file creating using Maven 2. The war is a snapshot file which contains a META-INF/context.xml file. It seems that this file is being ignored when deploying this way and the war file-name is being used instead. I thought the purpose of the context file is to define the context path for the web application. From my understanding from the documenation: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html You appear to have misunderstood. Which part of the doc did you get this from and I'll see if it can be made clearer. This should work as I expect. No it shouldn't. Is this the correct behavior? The current behaviour is correct. Thanks for any help. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5. META-INF/context.xml ignored when deploying as war.
Mark, thanks for the reply. You appear to have misunderstood. Which part of the doc did you get this from and I'll see if it can be made clearer. From my understanding of the the order of precedence. [quote] *Context* elements may be explicitly defined: - in the $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps - in the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.defaultfile: the Context element information will be loaded by all webapps of that host - in individual files (with a .xml extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file (less the .xml) extension will be used as the context path. Multi-level context paths may be defined using #, e.g. context#path.xml. The default web application may be defined by using a file called ROOT.xml. - if the previous file was not found for this application, in an individual file at /META-INF/context.xml inside the application files - inside a Hosthttp://tomcat.apache.org/tomcat-5.5-doc/config/host.htmlelement in the main conf/server.xml [/quote] I thought this means that if there isn't a context for this webapp in $CATALINA_HOME/conf/context.xml, or in $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default, or just in the [hostname] directory, then it would use the context defined in the web application META-INF/context.xml. Is there a different handling for packaged webapps (wars) vs. an exploded directory? Thanks, Eric -- Learn from the past. Live in the present. Plan for the future. 11101000 http://www.townsfolkdesigns.com/blogs/elberry
Re: Tomcat 5.5. META-INF/context.xml ignored when deploying as war.
Eric Berry wrote: Mark, thanks for the reply. You appear to have misunderstood. Which part of the doc did you get this from and I'll see if it can be made clearer. From my understanding of the the order of precedence. [quote] *Context* elements may be explicitly defined: - in the $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps - in the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.defaultfile: the Context element information will be loaded by all webapps of that host - in individual files (with a .xml extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file (less the .xml) extension will be used as the context path. Multi-level context paths may be defined using #, e.g. context#path.xml. The default web application may be defined by using a file called ROOT.xml. - if the previous file was not found for this application, in an individual file at /META-INF/context.xml inside the application files - inside a Hosthttp://tomcat.apache.org/tomcat-5.5-doc/config/host.htmlelement in the main conf/server.xml [/quote] Your original post referred to the context path. If you read further down in the description of the path element: quote The value of this field must not be set except when statically defining a Context in server.xml, as it will be inferred from the filenames used for either the .xml context file or the docBase. /quote I thought this means that if there isn't a context for this webapp in $CATALINA_HOME/conf/context.xml, or in $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default, or just in the [hostname] directory, then it would use the context defined in the web application META-INF/context.xml. That isn't quite how it works. $CATALINA_HOME/conf/context.xml provides global defaults which can be overridden at the host level by: $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.defaultfile which in turn can be overridden at the context level by: $CATALINA_HOME/conf/[enginename]/[hostname]/contextpath.xml If a contextpath.xml exists, it always takes priority over anything in a WAR or an exploded directory. Is there a different handling for packaged webapps (wars) vs. an exploded directory? There is a slight one. For WARs with a context.xml, it will get copied to $CATALINA_HOME/conf/[enginename]/[hostname]/ if a contextpath.xml does not exist. context.xml files in an exploded directory do not get copied. This is an inconsistency that is on my list to fix as part of fixing https://issues.apache.org/bugzilla/show_bug.cgi?id=42747 Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5. META-INF/context.xml ignored when deploying as war.
That isn't quite how it works. $CATALINA_HOME/conf/context.xml provides global defaults which can be overridden at the host level by: $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.defaultfile which in turn can be overridden at the context level by: $CATALINA_HOME/conf/[enginename]/[hostname]/contextpath.xml If a contextpath.xml exists, it always takes priority over anything in a WAR or an exploded directory. Is there a different handling for packaged webapps (wars) vs. an exploded directory? There is a slight one. For WARs with a context.xml, it will get copied to $CATALINA_HOME/conf/[enginename]/[hostname]/ if a contextpath.xml does not exist. context.xml files in an exploded directory do not get copied. This is an inconsistency that is on my list to fix as part of fixing https://issues.apache.org/bugzilla/show_bug.cgi?id=42747 Mark Ok cool. Thank you very much for clearing that up for me. The first time I deployed the war, there wouldn't have been a context in any of the 3 locations mentioned above. As you said, it would have copied the context.xml file from the war into the 3rd location as contextpath.xml correct? I looked at in $CATALINA_HOME/conf/[enginename]/[hostname]/, and sure enough there is a mywar-snapshot.xml. When I look at the contents of that file it it contains this: [quote] Context path=/mywar / [/quote] So in this case the file-name itself is actually used rather than the path specified in this file? I know you quoted this from the documentation, I just wanted to clarify that this is what it meant. My understanding aside, this seems a bit counter-intuitive to me. Why recommend the use of the context.xml if it really isn't used? I'll be honest I have very little experience deploying using a war, I usually deploy as an exploded directory, but I always had the impression the name of file was used as a default case when a more specific context.xml wasn't present. In either case, thank you very much for the help. Cheers, Eric -- Learn from the past. Live in the present. Plan for the future. 11101000 http://www.townsfolkdesigns.com/blogs/elberry