1

Basically I am trying to Map a servlet to my web.xml file in Eclipse, But then when I call my servlet at browser I get the apache error 404 (File Not Found) Error.

   <servlet>
     <servlet-name>watch</servlet-name>
     <servlet-class>duck.reg.pack.watch</servlet-class>
   </servlet>
   <servlet-mapping>
     <servlet-name>watch</servlet-name>
     <url-pattern>/watch</url-pattern>
  </servlet-mapping>

Project Name Duck.

But then when I call it as http://localhost:20012/Duck/watch Apache error 404 is showen.

Much Regards

Whatever
  • 125
  • 2
  • 2
  • 8

1 Answers1

0

Here is a small list of possible things you can check:

  1. Check the servlet is inside the package duck.reg.pack.watch

  2. Make sure your form method is mapped onto the correct doGet or doPost request. A common mistake is incorrect mapping (doing a doPost request when your servlet only has a doGet)

  3. Servlet names by convention are capitalized.

  4. Create a doGet method (if you don't already have one) and check if the following mapping works:

localhost:20012/Duck/watch

localhost:20012/watch
  1. Restart and clean/rebuild your server. Depending on your configuration, sometimes changes made in web.xml do not reflect until you restart the server.
Jonathan Laliberte
  • 2,672
  • 4
  • 19
  • 44