1. Is the URL right?
The context path is the WAR file name without .war. A file shop.war is served at /shop/, not at /. Only ROOT.war is served at the root. If you open http://server:8080/ and get a 404 from Tomcat itself, that is normal when no ROOT application exists.
2. Did Tomcat unpack and start it?
ls -l /var/lib/tomcat10/webapps/
You should see both shop.war and a folder shop/. No folder means Tomcat did not deploy the file. Check:
- Owner. The file must be readable by the tomcat user:
sudo chown tomcat:tomcat /var/lib/tomcat10/webapps/shop.war. - Copy still running. Copy to a temporary name and then rename, so Tomcat never sees half a file.
- unpackWARs and autoDeploy. They are on by default. Look at the
Hostelement inserver.xmlif someone changed them.
3. Read the deployment log
sudo grep -n -E "Deploying|Deployment of|SEVERE" /var/log/tomcat10/catalina.*.log | tail -20
sudo tail -n 80 /var/log/tomcat10/localhost.$(date +%F).log
A failed deployment logs SEVERE with the exception. In that case the folder exists but requests return 404 or 503.
4. The namespace trap
Tomcat 10 and newer read jakarta.servlet. A WAR built for javax.servlet may deploy without a clear error and then answer 404 for its servlets. Check which version you run with sudo -u tomcat /usr/share/tomcat10/bin/version.sh (the path differs for tarball installs). If the application is older, either run Tomcat 9 or migrate to jakarta.
5. The 404 comes from the application
If the HTML of the 404 page is not Tomcat's, the application answered. Then it is a routing problem inside the app: a missing servlet mapping, a Spring controller path that does not include the context path, or an index page that does not exist. Test with the full path, for example /shop/index.html.
6. Nginx in front
If you use a proxy, proxy_pass http://127.0.0.1:8080; forwards the path unchanged. A trailing path in proxy_pass rewrites it. Compare curl http://127.0.0.1:8080/shop/ with the public URL to see where the difference starts.
Questions about fix tomcat 404
How do I make my application the root of the site?
Name the file ROOT.war, in capitals, and remove the old unpacked folder. Or put a ROOT.xml context file in conf/Catalina/localhost.
Last updated October 29, 2026.