This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Webapps and Context Path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Webapps and Context Path" Watch "Webapps and Context Path" New topic

Webapps and Context Path

Ram Mehta

Joined: Nov 02, 2012
Posts: 1
I have 2 application deployed in one server ( Tomcat 7.0.28 ) and we have also update the context path in server.xml as below

We have noticed sometime the context path directories ( XX and YY ) are creating in webapps directory when the server gets rebooted. So the webapps has below folders.

app1.war app1 app2.war app2 XX YY

We have builded are more than 10 servers and only couple of servers have this issue.

Any thoughts ?

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

What's the issue? The wars are being unpacked into a folder structure. This is the normal default behavior.

There is a setting (not sure which off the top of my head) to have Tomcat simply run the app out of the war without "exploding" it, if that's what you want. Look through the Tomcat docs for configuration and you should find it.

[Asking smart questions] [About Bear] [Books by Bear]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

You should NOT put your context definitions in the server.xml file. That behaviour has been discouraged since Tomcat4 first came out. Put each context definition in its own file with an ".xml" suffix and place the files in the TOMCAT_HOME/conf/Catalina/localhost directory. Note that the context name that the app will be deployed under will be taken from the context filename (minus the ".xml" part, and not from the name in the Context element itself

The option for keep WARs from being exploded is "unpackWAR".

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Webapps and Context Path
jQuery in Action, 3rd edition