Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Re: javax.servlet.ServletException: Cannot allocate servlet instancefor path /servlet/HelloWorld (repost I don't resolve the problem with your reply)

Hassan Schroeder

2007-08-02


On 8/2/07, Fabbris Pierluigi <pierluigi.fabbris@(protected):

> javax.servlet.ServletException: Cannot allocate servlet instance for path /servlet/HelloWorld

> *My first servlet in directory classes is:*

Uh, well -- this *isn't* a servlet. I'm guessing that's the problem :-)
javax.servlet.Servlet is an interface -- your servlet needs to extend
it (actually HttpServlet in this case).

> class HelloWorld {
>     public static void main(String[] args)
>    {
>        System.out.println("Hello World!");
>    }
> }

See the examples packaged with Tomcat, and take a look at the
Servlet Spec JavaDocs.

HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder@(protected)

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.