I have downloaded the Apache Tomcat Software (Tomcat 4.1) and appropriately set the two environmental variables namely- JAVA_HOME and CATALINA_HOME. I am using Windows 2000 Pro. The Web server is running fine at http://localhost:8080/. The classpath is set appropriately. I have compiles a TestServlet.java file and placed the same in in install_dir/webapps/ROOT/WEB-INF/classes directory. After compiling the code, access the servlet with the URL http://localhost/servlet/HelloServlet (or http://localhost:8080/servlet/HelloServlet but it is giving me error messag. So, what could be the problem.
Originally posted by Jaggi Kunal: [...] but it is giving me error messag. So, what could be the problem.
I've pumped up my karma 'till it burst and had seances with all my astral connections, but I still cannot discern the nature of the error message by occult means. Perhaps posting the message text and, if possible, a stack trace would help? - Peter
You need to uncomment the following code in the web.xml file under <your tomcat install folder>/conf Look for the following lines and uncomment the lines related to the invoker servlet <!-- The mapping for the invoker servlet --> <!-- <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping> --> Now restart your tomcat server and test the example using the URL http://localhost:8080/chapter01/servlet/HelloWorldServlet It will work for you now. Srinivas
Jaggi, You should definitely try Srinivas's suggestion (it works for me like a charm when I just come to tomcat world) more detailed info, the section Srinivas mentioned is around lines 273-278 inside the web.xml I have (i am using 4.1.18). <!-- The mapping for the invoker servlet --> <!-- remove this <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping> --> remove this [ January 31, 2003: Message edited by: chi Lin ]
not so smart guy still curious to learn new stuff every now and then
Hello Srinivas, Many thanks to u and all others. Now I can run the servlet code. Srinivas, which book are you using to prepare for SCWCD Certification? I have recently purchased the Wrox SCWCD book. After having gone through the first few chapters I can say that this book is not for beginners like me who are new to Servlets and JSP. Is there any book on Servlets/JSP which requires no prerequisites, how about Core Servlets and JSP by Marty Hall, although the Indian reprint of this book is not available, but is it worth the cost (Approx. Rs. 1029/-). Regards, Kunal Jaggi SCJP2 [ January 31, 2003: Message edited by: Jaggi Kunal ]