Tomcat 8管理器部署WAR文件后无法定位文件路径求助
Hey there! I’ve dealt with this exact head-scratcher before—Debian’s packaged Tomcat splits its directories differently from the vanilla Tomcat download, which is why you couldn’t find your WAR in /etc/tomcat8 or /usr/share/tomcat*. Let’s get this sorted:
The Exact Location
When you upload a WAR via the Tomcat 8 Manager on Debian 9, the file (and its extracted app directory) gets stored in:
/var/lib/tomcat8/webapps/
Why the Other Paths Don’t Have It
Let’s quickly clarify what those other directories are for, so you don’t waste time looking there again:
/etc/tomcat8/: This is only for configuration files (likeserver.xml,web.xml, and manager settings)/usr/share/tomcat*/: This holds Tomcat’s core binaries, libraries, and default documentation—your deployed apps don’t live here/var/lib/tomcat8/: This is Tomcat’sCATALINA_BASEdirectory, where all runtime data (including deployed web apps, logs, and work files) is stored
How to Confirm It’s There
Run this command in your terminal to list the contents of the webapps directory:
ls -la /var/lib/tomcat8/webapps/
You’ll either see HelloServlet.war (the original uploaded file) or a HelloServlet/ directory (the extracted app—sometimes Tomcat removes the WAR after extraction, but the "already exists" error means the app is still tracked in this directory).
Optional: Verify via Tomcat Config
If you want to double-check the app base path yourself, open Tomcat’s main server configuration file:
sudo nano /etc/tomcat8/server.xml
Look for the <Host> element (usually around lines 140–150). It will have an appBase attribute set to webapps, which is relative to CATALINA_BASE (/var/lib/tomcat8/), so the full path is /var/lib/tomcat8/webapps/.
If you need to re-upload a fresh version of your WAR, just delete the existing HelloServlet.war or HelloServlet/ directory from that path, then try uploading again.
内容的提问来源于stack exchange,提问作者Max Li

