This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes servlet not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet not working" Watch "servlet not working" New topic
Author

servlet not working

siva raman
Greenhorn

Joined: Sep 15, 2003
Posts: 5
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.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
Gayathri Prasad
Ranch Hand

Joined: Jun 25, 2003
Posts: 116
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
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: servlet not working
 
Similar Threads
using servlets in Jboss-tomcat
servlet mapping
404 error when accessing servlet?
error in accessing servlet from a remote PC
kindly help me in redirecting....... as soon as possible