|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
root context path - war file not unwar'dHello,
I have an issue where inside a <host> i set the context path of "/" to a directory inside webapps (myapp). The issue is when i delete the directory , on first startup the directory is not available yet (not unwar'd yet it appears) so it auto-sets the root context path to the default tomcat application. If I simply restart tomcat, everything works as expected (because the directory is now there). Does anyone know if there is a way to ensure that new war files are unwar'd prior to any other execution so this doesnt screw up the context path settings? We like to delete the directory when deploying new wars since we have seen some issues not deleting the directories before. Tomcat 5.5.26 Java 1.6 Solaris 10 Thx Adam |
|
|
RE: root context path - war file not unwar'd> From: AD [mailto:straightflush@...]
> Subject: root context path - war file not unwar'd > > I have an issue where inside a <host> i set the context path > of "/" to a directory inside webapps (myapp). This is bad practice, and gets your webapp deployed twice. Sounds like you also didn't remove the existing webapps/ROOT directory, so you now have two webapps fighting to be the default one. Since you're not doing things in the recommended fashion, no particular behavior is guaranteed. What you should be doing: 1) Delete the existing webapps/ROOT directory, thereby removing the dummy default webapp that ships with Tomcat. 2) Delete everything under Tomcat's work directory, since that likely is very confused by now. 3) Remove the <Context> element from server.xml - it doesn't belong there. 4) Rename your webapp to ROOT.war, so it becomes the default webapp. 5) If you actually need a <Context> element for your webapp, place it in META-INF/context.xml inside the ROOT.war file, or in conf/Catalina/[host]/ROOT.xml; in either case, remove the path and docBase attributes, since they're not allowed. (If your <Context> element contained only path and docBase, you don't need one at all.) When redeploying a webapp, don't just randomly delete directories while Tomcat is running. Use the manager webapp or the appropriate ant script to do a proper redeployment. - 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-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: root context path - war file not unwar'dThanks charles, i thought there was an easier way to make a default webapp
other than naming it ROOT.war. I will give that a shot to see if it works. Adam On Mon, Jan 19, 2009 at 10:36 PM, Caldarale, Charles R < Chuck.Caldarale@...> wrote: > > From: AD [mailto:straightflush@...] > > Subject: root context path - war file not unwar'd > > > > I have an issue where inside a <host> i set the context path > > of "/" to a directory inside webapps (myapp). > > This is bad practice, and gets your webapp deployed twice. Sounds like you > also didn't remove the existing webapps/ROOT directory, so you now have two > webapps fighting to be the default one. Since you're not doing things in > the recommended fashion, no particular behavior is guaranteed. > > What you should be doing: > > 1) Delete the existing webapps/ROOT directory, thereby removing the dummy > default webapp that ships with Tomcat. > > 2) Delete everything under Tomcat's work directory, since that likely is > very confused by now. > > 3) Remove the <Context> element from server.xml - it doesn't belong there. > > 4) Rename your webapp to ROOT.war, so it becomes the default webapp. > > 5) If you actually need a <Context> element for your webapp, place it in > META-INF/context.xml inside the ROOT.war file, or in > conf/Catalina/[host]/ROOT.xml; in either case, remove the path and docBase > attributes, since they're not allowed. (If your <Context> element contained > only path and docBase, you don't need one at all.) > > When redeploying a webapp, don't just randomly delete directories while > Tomcat is running. Use the manager webapp or the appropriate ant script to > do a proper redeployment. > > - 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-unsubscribe@... > For additional commands, e-mail: users-help@... > > |
|
|
Re: root context path - war file not unwar'dIf it helps it's also possible to deploy your war file with any name at all and have it deployed as the default context "/" - without the need to name it ROOT.war.
The trick is to have it located outside the Tomcat directory and have the ROOT.xml context docBase point to it whilst setting path="". Exact details can be found here: Tomcat ROOT.war deployment |
|
|
Re: root context path - war file not unwar'dAndrew Eells wrote:
> If it helps it's also possible to deploy your war file with any name at all > and have it deployed as the default context "/" - without the need to name > it ROOT.war. > > The trick is to have it located outside the Tomcat directory and have the > ROOT.xml context docBase point to it whilst setting path="". Exact details > can be found here: This is incorrect. If you have an app located outside of the defined webapps dir and are using the docBase attribute then merely naming the context XML file "ROOT.xml" is enough. You may consider the following: a normally deployed ROOT.war causes a ROOT.xml to be created - it is this special name that locates the web application at the path "/". You may only use path="" when the context is defined in server.xml, (when a ROOT.xml would not exist) - a practice which is very strongly discouraged anyway. p > http://www.andrew-eells.com/2009/03/21/tomcat-root-war/ Tomcat ROOT.war > deployment > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: root context path - war file not unwar'dpid-2 is right in that the path shouldn't be used here, if i remove this Tomcat still deploys myapp.war as "/" as it's using the name of the ROOT.xml file to infer the actual path.
i misread the tomcat context documentation http://tomcat.apache.org/tomcat-5.5-doc/config/context.html. deploying your war file without having to rename it ROOT.war or use Apache RewriteRules to rewrite "/myapp" to "/" is still preferable in my opinion though, and the real point of the article. just don't set the "path"! thanks pid-2
|
| Free embeddable forum powered by Nabble | Forum Help |