Hey everyone.

I have setup tomcat 4.0b1 and have it working fine for a very simple
servlet.  Just prints a string to the web browser.  As soon as I try and
introduce a parent class (that will handle some initialization) for all my
servlets, tomcat blows up.

I get this error: "java.lang.NoClassDefFoundError:
javax/servlet/http/HttpServlet" along with a stack trace.  I don't
understand at all.  Does tomcat expect the servlets to extend "HttpServlet"
directly instead of being a subclass of a class that extends "HttpServlet"?

In the code below case "A" works and "B" does not.  Ideas?  Suggestions?

Thanks,

-james



case A:
----------------------------------------------
public TestServlet extends HttpServlet
{
        public void doGet(HttpServletRequest request, HttpServletResponse response)
                throws IOException, ServletException
        {
                response.setContentType("text/html");
                PrintWriter out = response.getWriter();

                out.println("testing");
        }
}
----------------------------------------------



case B:
----------------------------------------------
public SpecialHttpServlet extends HttpServlet
{
        public void init()
                throws ServletException
        {
                // do some initialization stuff
        }
}

public TestServlet extends SpecialHttpServlet
{
        public void doGet(HttpServletRequest request, HttpServletResponse response)
                throws IOException, ServletException
        {
                response.setContentType("text/html");
                PrintWriter out = response.getWriter();

                out.println("testing");
        }
}
----------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to