Search code examples
eclipseservletstomcat6eclipse-wtp

Requested Resource (servlet name) not found Tomcat Eclipse IDE


I am trying to deploy a servlet on Tomcat from Eclipse using WTP plugin. Eclipse is working fine and Tomcat is also up. As when I open http://localhost:8080 I get the home page of Tomcat. I am following this exact tutorial http://www.vogella.com/articles/EclipseWTP/article.html but when I try to deploy it on tomcat by right clicking on servlet class and run as run on server I get following error. The requested resource (/test/FileCounter) is not available. I searched but could not find anything which could help me. I am using Eclipse Java EE IDE and Tomcat 6. Following is my web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 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">
  <display-name>test</display-name>
  <servlet>
    <description></description>
    <display-name>FileCounter</display-name>
    <servlet-name>FileCounter</servlet-name>
    <servlet-class>com.servlets.FileCounter</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>FileCounter</servlet-name>
    <url-pattern>/FileCounter</url-pattern>
  </servlet-mapping>
</web-app>

Solution

  • I faced this same problem and just solved it !

    In the Project Explorer , expand the Deployment descriptor ( just above the Java resource ) . Then expand "servlet" in that deployment descriptor , their should be your created Servlet. Right click on it and Run as --> Run on server .

    But one thing isn't clear to me in Eclipse that web.xml is not defined properly but the servlet is running without it !