Running servlets on Apache

Posted on 2006-03-19
Last Modified: 2010-03-04

I am not able to run servlets on Apache Tomcat server. I have installed Tomcat 5.0.28. My jdk version is 1.4.2_07. I am using eclipse as java editor. Each time i try to run the servlet, i am getting an error stating "requested resource not available".


Question by:karthik_212
    LVL 10

    Accepted Solution

    Hi karthik_212,

    1. Your servlets should have a package declaration
    2. You should place the servlet class in WEB-INF\classes folder, following the package structure.
       If, you should place TestServlet.class in WEB-INF\classes\com\foo directory.

    LVL 35

    Assisted Solution

    You also need to declare your servlets and the mapping to them in the WEB-INF/web.xml file



    Then go to http://localhost:8080/yourwebapp/MyServletMapping

    And your servlet should run :-)


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
    Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now