Dear programmers, I am just now learning servlets using Tomcat . I wrote a small HelloWorld programe and kept it in the root dir of the server. But when i try to access this servlet by giving the URL http://localhost:8080/servlet/servlet_name Iam getting the error message that this servlet could not be found. when I try the examples given along with the Tomcat, everything works fine. Why is this.I have also created the dir as said in the documentation. thanking you, L.sivaraman.
In tomcat you have to deploy your web application into $TOMCAT_HOME/webapps/. Copy there your war file or your directory with the appropriate structure (incl. WEB-INF, META-INF). There you also have to define your web.xml (descriptor of your webapplication) Check out this tutorial
Hi, If ur trying to check a simple HelloWorld.java Servlet then follow this in ur tomcat home directory i.e tomcat4.1->webapps->examples->WEB-INF->classes put ur servlet class files here and access them thru ur container as u access the example servlets. Cheers, Gaya3
The url nomenclature that uses "servlet/" uses the "invoker" servlet to find the actual servlet class. Tomcat used to come with this servlet on by default so you see it used in books alot. However, for Tomcat 4 the invoker is off in the ROOT application and on in the examples. Search the web.xml file in the conf directory for "invoker" to see more documentation. This question comes up ALOT - several times a week, so look at the recent posts. Bill