Servlet tag and servlet mapping tag are present in the web.xml as shown below

<servlet>
     <servlet-name>AbcServlet</servlet-name>
     <servlet-class>edu.studies.service.AbcServlet</servlet-class>
     <load-on-startup>0</load-on-startup>
   </servlet>
  
  <servlet-mapping>
    <servlet-name>AbcServlet</servlet-name>
    <url-pattern>/abc/*</url-pattern>
  </servlet-mapping>

But it still says The requested resource (Servlet AbcServlet is not available) is not available. What did I miss? Please help.

Recommended Answers

All 3 Replies

Are you sure that your servlet after compile was placed in correct directory PROJECT/WEB-INF/classes/edu/studies/service/AbcServlet ?

Thanks for responding. Yes, I am sure. I even checked the WAR file expanded by Tomcat to ensure that the class file is in appropriate location.

I suspect that the problem has something to do with finding the <servlet-name> tag itself rather than finding the appropriate servlet class. Because if I change the <servlet-name> tag value from AbcServlet to AbcdServlet in both <servlet> and <servlet-mapping>, the error becomes The requested resource (Servlet AbcServlet is not available) is not available.

Well, I am just a newbie and this is only my guess.

But it still says The requested resource (Servlet AbcServlet is not available) is not available. What did I miss? Please help.

What do the Tomcat logs say? If you see nothing unusual there, paste the URL you are trying to hit along with the directory structure you are using for your class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.