Home / Java Patterns and Pitfalls     frequal.com

Check WAR File Name To Avoid 404 Errors

One of the most common problems that cause 404 errors when accessing a Java web application is a mismatch between the WAR file name and the URL being used to access it.

For example, say you create a WAR file named math.war. In web.xml, you specify the servlet-mapping url-pattern of /worksheet. When you copy the war file to your Tomcat webapps folder, then the URL will be:

The /worksheet part of the URL is relative to the root of the web application, which defaults to the name of the WAR file.

If you don't remember the WAR file name in the URL, you will get mysterious 404 errors from Tomcat when trying to access your application. The requested resource is not available.

Last modified on 30 Mar 2012 by AO

Copyright © 2016 Andrew Oliver