<p>What culprits are the most likely to cause a <code>404 resource not found</code> error when a page in a given .WAR, autocreated by Sun's J2EE <code>deploytool</code>, is trying to load a Servlet in the same .WAR file?
<br/>
Eg:</p>

<blockquote>
  <p> <h1>HTTP Status 404 - /MyServlet/MyServlet</h1><p><b>type</b> Status report</p><p><b>message</b> /MyServlet/MyServlet</p><p><b>description</b> The requested resource (/MyServlet/MyServlet) is not available.</p></p>
</blockquote>

<p><hr>
Related: Of these, how many would you expect to be server specific? eg: <i>Sun Java Application Server </i> vs <i>Tomcat &amp; Catalina </i>?</p>

[{'answer_id': 66792, 'author': 'pkaeding', 'author_id': 4257, 'author_profile': 'https://Stackoverflow.com/users/4257', 'pm_score': 3, 'selected': False, 'text': "<p>Is there a valid &lt;servlet-mapping&gt; for 'MyServlet' in your web.xml?  That's been my number one culprit in the past</p>\n"}, {'answer_id': 66821, 'author': 'MetroidFan2002', 'author_id': 8026, 'author_profile': 'https://Stackoverflow.com/users/8026', 'pm_score': 1, 'selected': False, 'text': '<p>A 404 error means that the requested resource was not found.  As pkaeding suggests, it is probably due to the servlet mapping not being correct (or not being present) in the web.xml file.  Servlets must be specified in the web.xml file, and not only that, but they must be mapped to particular paths (an "url-mapping").  If the "MyServlet" servlet exists, but is not mapped to a path that may resolve with "/MyServlet/MyServlet" based on the application context root, and nothing else (i.e. another servlet, etc) resolves with this path, the application server will throw a 404 stating that nothing is mapped to the given path.</p>\n'}, {'answer_id': 196427, 'author': 'nerraga', 'author_id': 2376109, 'author_profile': 'https://Stackoverflow.com/users/2376109', 'pm_score': 0, 'selected': False, 'text': "<p>I just spent about an hour pulling my hair out on this very problem. Tomcat 5.5.27 on OSX was working just fine until I'd added another servlet and servlet-mapping at which point <em>everything</em> was returning a 404. I hadn't realized it, but when I'd added a new servlet/servlet-mapping pair I'd put the servlet-mapping before the servlet entry. It's an easy mistake to make and, although knee-capping the entire application without giving anything resembling a sensible error message seems a little extreme, it makes perfect sense in retrospect.</p>\n"}, {'answer_id': 1261685, 'author': 'JeffJak', 'author_id': 149923, 'author_profile': 'https://Stackoverflow.com/users/149923', 'pm_score': 0, 'selected': False, 'text': '<p>Servlet mapping is a common problem.  But if you have any fitlers in your web.xml those can be the culprit as well.  One thing to realize is filters always execute the code before the doFilter before any servlets starts executing.  (Technically filters execute code after the doFilter)  In our code we created filters that would return 404 under certain situations.  Sometimes removing some or all filters-mapping will help discover if it is related to filter-mappings.</p>\n'}]
['https://Stackoverflow.com/questions/66767', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9943/']