Monday, May 14, 2012

How to colve "javax.servlet.UnavailableException" or Servlet is not a javax.servlet.Servlet

If you get the following error message:


javax.servlet.UnavailableException: Servlet class com.example.test.myServlet is not a javax.servlet.Servlet

This is because you did not extends the class  com.example.test.myServlet with HttpServler.

The class below will cause javax.servlet.UnavailableException

public class myServlet {
   public void doPost(HttpServletRequest req, HttpServletResponse resp) {
        ...
   }

}

You solve this by extending this class with HttpRequest:
public class myServlet extends HttpServlet  {
   public void doPost(HttpServletRequest req, HttpServletResponse resp) {
        ...
   }

}

No comments:

Post a Comment