title: 404 error servlet jsp
body: <p>I am currently working on a simple web App project with eclipse.</p>
  
  <p>I use centos server and apache-tomcat-7.0.47.</p>
  
  <p>I have an <strong>index.jsp</strong> file:</p>
  
  <pre><code>&lt;form action="MyServlet"&gt;
     &lt;input type="submit" value="Send" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My servlet file <strong>MyServlet.java</strong> :</p>
  
  <pre><code>package com.srk.pkg;
  
  import java.io.IOException;
  import java.io.PrintWriter; 
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  /**
    * Servlet implementation class MyServlet
  */
  public class MyServlet extends HttpServlet {
  private static final long serialVersionUID = 1L;
  
      /**
        * @see HttpServlet#HttpServlet()
      */
      public MyServlet() {
         super();
      }
  
     /**
         * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
       protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          PrintWriter out = response.getWriter();
          out.print("Hello Everybody..");
     }
  
     /**
      * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      // TODO Auto-generated method stub
     }
  }
  </code></pre>
  
  <p>and my <strong>web.xml file:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xmlns="http://java.sun.com/xml/ns/javaee"  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
    &lt;display-name&gt;Example1&lt;/display-name&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
    &lt;servlet&gt;
      &lt;description&gt;&lt;/description&gt;
      &lt;display-name&gt;MyServlet&lt;/display-name&gt;
      &lt;servlet-name&gt;MyServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.srk.pkg.MyServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;MyServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/MyServlet&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;  
  </code></pre>
  
  <p>The problem I have is:</p>
  
  <p>I run the web app from eclipse and everything is ok.</p>
  
  <pre><code> http://localhost:8080/Example1/index.jsp
  </code></pre>
  
  <p>and</p>
  
  <pre><code> http://localhost:8080/Example1/MyServlet?
  </code></pre>
  
  <p>but when i try accessing it from my centos server i get a</p>
  
  <pre><code>HTTP Status 404 - /Example1/WebContent/MyServlet
  </code></pre>
  
  <p>type Status report</p>
  
  <pre><code>message /Example1/WebContent/MyServlet
  </code></pre>
  
  <p>description The requested resource is not available.</p>
  
  <p>Can anyone help me??</p>
  
  <p>The links i use:</p>
  
  <pre><code>.....:8080/Example1/WebContent/index.jsp
  </code></pre>
  
  <p>and </p>
  
  <pre><code>....:8080/Example1/WebContent/MyServlet?
  </code></pre>
  
  <p>also</p>
  
  <p><img src="https://i.stack.imgur.com/CLKMX.png" alt="Package explorer"></p>