Re: Context root query
Thanks a lot Mark for such a elaborate explanation. Your suggestion worked i have implemented the same Cheers, Vicky On Nov 21, 2012, at 12:23 AM, Mark Eggers its_toas...@yahoo.com wrote: On 11/20/2012 10:32 AM, vicky wrote: MARK - My client has application archives files which all have version string in it as stated below :- eg:- mom-1.2.0.war, mom-1.3.0.war, mom-1.4.0.war, mom-1.5.0.war So they doest want the version string mentioned in the application archive to become part of application context. The context should remain same irrespective of the application archive they deploy, Do you have any better approach /suggestion for this requirement thanks for your help vicky From: Mark Thomas ma...@apache.org To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, 20 November 2012 11:51 PM Subject: Re: Context root query On 20/11/2012 17:47, vicky wrote: 3 As i have a user requirement that they want to have a application context as different from application archive file name That sounds like an x-y problem to me. What is the real user requirement? Mark As has been said before: 1. Create a directory This should be outside of the appBase for the host you're deploying on. This should also not be in a place where a web server can serve content (see below). 2. Add all the war files mom-1.1.0.war mom-1.2.3.war mom-5.7.9.war 3. Create a mom.xml file In the mom.xml file, have a context element. It should read something like the following: Context docBase=/your-directory/mom-1.2.3.war/ That's it. No reloadable=true, no debug=0, no crossContext=false. reloadable=true is not recommended for production environments, there is no debug attribute, and crossContext=false is the default. 4. Place the file in the appropriate spot. $CATALINA_BASE/conf/[hostname]/mom.xml is where it goes. The above configuration will serve mom-1.2.3.war as context mom for that host when accessed from Tomcat. And no, hacking server.xml, adding a path attribute to the context.xml file (mom.xml file), and other such games will either not work or cause you nothing but grief. Note on the above. Do NOT place this war file where Apache HTTPD (or another web server) can serve the content directly. If it's a WAR file, the user will get to download a copy of the application. If it's an exploded WAR file (directory, etc.) then JSP files will get served as source (most likely), and anything in WEB-INF will be served by the web server unless you've taken special precautions. Just follow the instructions in the Tomcat documentation. . . . . just my two cents. /mde/ - 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 root query
did you reload tomcat after changing the file? On Tue, Nov 20, 2012 at 7:51 AM, vicky007aggar...@yahoo.co.in wrote: Hello Guys, I am trying to define the context root in my application using context.xml. I defined the following in application context.xml under meta-inf directory Context path=/app1 privileged=true/ But still tomcat is referring the application name as my context. The value which i defined in context.xml is not getting referenced by tomcat. Can some one please help me in defining the context root for an application . I don't want to use the application name as context root for my app. Thanks for your help, Vicky - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Context root query
vicky007aggar...@yahoo.co.in wrote: Hello Guys, I am trying to define the context root in my application using context.xml. I defined the following in application context.xml under meta-inf directory Context path=/app1 privileged=true/ But still tomcat is referring the application name as my context. The value which i defined in context.xml is not getting referenced by tomcat. Can some one please help me in defining the context root for an application . I don't want to use the application name as context root for my app. This is described in detail in the Tomcat Wiki. http://wiki.apache.org/tomcat/HowTo, #18. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Context root query
André Warnier wrote: vicky007aggar...@yahoo.co.in wrote: Hello Guys, I am trying to define the context root in my application using context.xml. I defined the following in application context.xml under meta-inf directory Context path=/app1 privileged=true/ But still tomcat is referring the application name as my context. The value which i defined in context.xml is not getting referenced by tomcat. Can some one please help me in defining the context root for an application . I don't want to use the application name as context root for my app. This is described in detail in the Tomcat Wiki. http://wiki.apache.org/tomcat/HowTo, #18. Apologies: That was a correct answer, but not to your question. Sorry, I misinterpreted root as ROOT. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Context root query
Helo, Yes , i restarted tomcat after that but that doesn't help. But if i define the following in server.xml , i am able to override the default context root of an application successfully Context path=/tests docBase=/var/www/test_application1/ debug=0 reloadable=true crossContext=false /Context But this is not the appropriate way as i don't want to touch the tomcat server.xml for every application Please suggest how i can override the context root of an application using META-INF/context.xml Thanks for your time, Vicky On Nov 20, 2012, at 6:35 PM, Elias Kopsiaftis yemi...@gmail.com wrote: did you reload tomcat after changing the file? On Tue, Nov 20, 2012 at 7:51 AM, vicky007aggar...@yahoo.co.in wrote: Hello Guys, I am trying to define the context root in my application using context.xml. I defined the following in application context.xml under meta-inf directory Context path=/app1 privileged=true/ But still tomcat is referring the application name as my context. The value which i defined in context.xml is not getting referenced by tomcat. Can some one please help me in defining the context root for an application . I don't want to use the application name as context root for my app. Thanks for your help, Vicky - 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 root query
From: vicky007aggar...@yahoo.co.in [mailto:vicky007aggar...@yahoo.co.in] Subject: Re: Context root query Please suggest how i can override the context root of an application using META-INF/context.xml You cannot. Please actually read the documentation everyone has been pointing you to. http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Defining_a_context - 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 root query
Pardon me if i am annoying , but from the below mail link, i located the snippet(mentioned below) in which its written that we can define application context in context.xml. ** Individual Context elements may be explicitly defined: In an individual file at /META-INF/context.xml inside the application files. Optionally (based on the Host's copyXML attribute) this may be copied to $CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to application's base file name plus a .xml extension. ** but wrong i am doing , in defining the context in META-INF/context.xml as follows :- Context path=/app1 privileged=true/ Does we cannot override the default application context in tomcat 6.0 using META-INF/context.xml Thanks all, Vicky From: Caldarale, Charles R chuck.caldar...@unisys.com To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, 20 November 2012 10:15 PM Subject: RE: Context root query From: vicky007aggar...@yahoo.co.in [mailto:vicky007aggar...@yahoo.co.in] Subject: Re: Context root query Please suggest how i can override the context root of an application using META-INF/context.xml You cannot. Please actually read the documentation everyone has been pointing you to. http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Defining_a_context - 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 root query
From: vicky [mailto:vicky007aggar...@yahoo.co.in] Subject: Re: Context root query i located the snippet(mentioned below) in which its written that we can define application context in context.xml. ** Individual Context elements may be explicitly defined: In an individual file at /META-INF/context.xml inside the application files. Optionally (based on the Host's copyXML attribute) this may be copied to $CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to application's base file name plus a .xml extension. ** And you completely ignored this wording in the description of the path element: This attribute must only be used when statically defining a Context in server.xml. In all other circumstances, the path will be inferred from the filenames used for either the .xml context file or the docBase. - 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 root query
Thanks a ton charles for passionatly explaining me the intrinsic things , it means a lot to me... 1 What sense does it make to statically defining a Context in server.xml ?? 2 Just to confirm , so using we cannot override the default application context using /META-INF/context.xml ?? 3 As i have a user requirement that they want to have a application context as different from application archive file name , so i can achieve this by adding the below snippet in server.xml, provided the docBase location shouldnt be the same as of Tomcat WebApps Directory to avoid double deployment . correct ?? Context path=/tests docBase=/var/www/test_application1/ debug=0 reloadable=true crossContext=false /Context Thanks Again From: Caldarale, Charles R chuck.caldar...@unisys.com To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, 20 November 2012 10:57 PM Subject: RE: Context root query From: vicky [mailto:vicky007aggar...@yahoo.co.in] Subject: Re: Context root query i located the snippet(mentioned below) in which its written that we can define application context in context.xml. ** Individual Context elements may be explicitly defined: In an individual file at /META-INF/context.xml inside the application files. Optionally (based on the Host's copyXML attribute) this may be copied to $CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to application's base file name plus a .xml extension. ** And you completely ignored this wording in the description of the path element: This attribute must only be used when statically defining a Context in server.xml. In all other circumstances, the path will be inferred from the filenames used for either the .xml context file or the docBase. - 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 root query
On 20/11/2012 17:47, vicky wrote: 3 As i have a user requirement that they want to have a application context as different from application archive file name That sounds like an x-y problem to me. What is the real user requirement? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Context root query
From: vicky [mailto:vicky007aggar...@yahoo.co.in] Subject: Re: Context root query What sense does it make to statically defining a Context in server.xml ?? Pretty much none, these days. Don't do it. we cannot override the default application context using /META-INF/context.xml ?? The path attribute is not allowed, except when using the strongly discouraged mechanism of placing the Context element in server.xml. As i have a user requirement that they want to have a application context as different from application archive file name Your user has a nonsensical requirement. If you can't get that changed, your best alternative is to keep the .war file completely outside of Tomcat's directory structure, and place a Context element in the file conf/Catalina/[host]/[appName].xml, with a docBase attribute pointing the absolute location of the .war file. i can achieve this by adding the below snippet in server.xml That is seriously not recommended. Use the approach outlined above instead. Context path=/tests docBase=/var/www/test_application1/ debug=0 reloadable=true crossContext=false /Context On a side note, did you see any debug attribute in the documentation for the Context element? Since you didn't, why are you using it? - 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 root query
MARK - My client has application archives files which all have version string in it as stated below :- eg:- mom-1.2.0.war, mom-1.3.0.war, mom-1.4.0.war, mom-1.5.0.war So they doest want the version string mentioned in the application archive to become part of application context. The context should remain same irrespective of the application archive they deploy, Do you have any better approach /suggestion for this requirement thanks for your help vicky From: Mark Thomas ma...@apache.org To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, 20 November 2012 11:51 PM Subject: Re: Context root query On 20/11/2012 17:47, vicky wrote: 3 As i have a user requirement that they want to have a application context as different from application archive file name That sounds like an x-y problem to me. What is the real user requirement? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Context root query
From: vicky [mailto:vicky007aggar...@yahoo.co.in] Subject: Re: Context root query My client has application archives files which all have version string in it as stated below :- eg:- mom-1.2.0.war, mom-1.3.0.war, mom-1.4.0.war, mom-1.5.0.war So they doest want the version string mentioned in the application archive to become part of application context. Do you have any better approach /suggestion for this requirement Move to Tomcat 7, and use the parallel deployment capability: http://tomcat.eu.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment - 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 root query
On 11/20/2012 10:32 AM, vicky wrote: MARK - My client has application archives files which all have version string in it as stated below :- eg:- mom-1.2.0.war, mom-1.3.0.war, mom-1.4.0.war, mom-1.5.0.war So they doest want the version string mentioned in the application archive to become part of application context. The context should remain same irrespective of the application archive they deploy, Do you have any better approach /suggestion for this requirement thanks for your help vicky From: Mark Thomas ma...@apache.org To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, 20 November 2012 11:51 PM Subject: Re: Context root query On 20/11/2012 17:47, vicky wrote: 3 As i have a user requirement that they want to have a application context as different from application archive file name That sounds like an x-y problem to me. What is the real user requirement? Mark As has been said before: 1. Create a directory This should be outside of the appBase for the host you're deploying on. This should also not be in a place where a web server can serve content (see below). 2. Add all the war files mom-1.1.0.war mom-1.2.3.war mom-5.7.9.war 3. Create a mom.xml file In the mom.xml file, have a context element. It should read something like the following: Context docBase=/your-directory/mom-1.2.3.war/ That's it. No reloadable=true, no debug=0, no crossContext=false. reloadable=true is not recommended for production environments, there is no debug attribute, and crossContext=false is the default. 4. Place the file in the appropriate spot. $CATALINA_BASE/conf/[hostname]/mom.xml is where it goes. The above configuration will serve mom-1.2.3.war as context mom for that host when accessed from Tomcat. And no, hacking server.xml, adding a path attribute to the context.xml file (mom.xml file), and other such games will either not work or cause you nothing but grief. Note on the above. Do NOT place this war file where Apache HTTPD (or another web server) can serve the content directly. If it's a WAR file, the user will get to download a copy of the application. If it's an exploded WAR file (directory, etc.) then JSP files will get served as source (most likely), and anything in WEB-INF will be served by the web server unless you've taken special precautions. Just follow the instructions in the Tomcat documentation. . . . . just my two cents. /mde/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Context root query
On 20/11/2012 18:45, Caldarale, Charles R wrote: From: vicky [mailto:vicky007aggar...@yahoo.co.in] Subject: Re: Context root query My client has application archives files which all have version string in it as stated below :- eg:- mom-1.2.0.war, mom-1.3.0.war, mom-1.4.0.war, mom-1.5.0.war So they doest want the version string mentioned in the application archive to become part of application context. Do you have any better approach /suggestion for this requirement Move to Tomcat 7, and use the parallel deployment capability: http://tomcat.eu.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment To be clear, use the naming convention mom##1.2.0.war and you'll get what you want. You don;t have do have multiple versions for this to work. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org