is servlet-api.jar on classpath
usually located at $CATALINA_HOME\lib\servlet-api.jar

what does your web-inf/web.xml look like?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Mon, 8 Jun 2009 04:25:36 -0700
> Subject: Servlet Error
> From: listan...@gmail.com
> To: users@tomcat.apache.org
> 
> Hi all,
> 
> I am new to Tomcat/Apache, and have just about started to learn JSP/Servlets
> as well.  I just wrote my first Hello world servlet (code below) and tried
> to run it, but got several errors. Here's exactly what I did:
> 1. I wrote "Hello.java" (code below) and put it in /webapps/ROOT directory
> 2. I tried to compile it ("javac Hello.java") but got errors. (see below)
> 
> I would appreciate if someone would tell me what I am missing. Also, after
> the servlet compiles, do I need to put it in WEB-INF?
> 
> Just for the records, I try to access the servlet using
> http://localhost:8080/Hello and I am using Java version 1.6.
> 
> Thanks in advance.
> 
> 
> 
> ---CODE---
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> 
> public class Hello extends HttpServlet {
>   public void doGet(HttpServletRequest request,
>                     HttpServletResponse response)
>       throws ServletException, IOException {
>     PrintWriter out = response.getWriter();
>     out.println("Hello World");
>   }
> }
> 
> 
> 
> --ERRORS--
> 
> Hello.java:2: package javax.servlet does not exist
> import javax.servlet.*;
> ^
> Hello.java:3: package javax.servlet.http does not exist
> import javax.servlet.http.*;
> ^
> Hello.java:5: cannot find symbol
> symbol: class HttpServlet
> public class Hello extends HttpServlet {
>                            ^
> Hello.java:6: cannot find symbol
> symbol  : class HttpServletRequest
> location: class Hello
>   public void doGet(HttpServletRequest request,
>                     ^
> Hello.java:7: cannot find symbol
> symbol  : class HttpServletResponse
> location: class Hello
>                     HttpServletResponse response)
>                     ^
> Hello.java:8: cannot find symbol
> symbol  : class ServletException
> location: class Hello
>       throws ServletException, IOException {
>              ^
> 6 errors

_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits. 
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009

Reply via email to