When does Tomcat unpack a war file to a ROOT folder?
java, tomcat, war, web-deployment
Solution
Name your war file ROOT.war. It will unpack to ../webapps/ROOT and map to / context
Problem
I'm trying to deploy a war on Tomcat 7.0, and in the `server.xml` file, I've set `unpackWARs = true` and `autoDeploy = true`. Since I want this war file to be the default web application, I have deleted the ROOT folder inside `...Tomcat7.0/webapps`. Then on, when I try to start the Tomcat service, I see a behavior that I have yet failed to identify a pattern in: - Sometimes, the war is unpacked to a newly created folder named 'ROOT'. - Some other times, it is unpacked to a folder that is named the same as the name of the war file. E.g. if the war file is 'MyWebApp.war', it's unpacked to a folder named 'MyWebApp'. It seems to be completely erratic and random, but I am sure there is method behind this apparent madness. As a rule, I am not sure if there is anything that dictates the creation of a ROOT folder. I have tried to edit the server.xml file and add context to my web application in it, but it doesn't seem to make a difference. What am I missing? Thanks in advance!