File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Cant run a Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cant run a Servlet" Watch "Cant run a Servlet" New topic

Cant run a Servlet

Pavani Sannidhanam

Joined: Feb 21, 2003
Posts: 1
I've installed Tomcat4.1.12 and j2sdk1.4.0_02and the class file is in the ROOT directory which is in the Tomcat software itself. The context path in servlet.xml was set to "ROOT".
The java servlet class file is stored in the directory:
The web.xml file for HelloWorld is in the dir WEB-INF. classes is a dir created by me. doesnt have any errors. Compilation was successful but cant run the Servlet. When i type the URL:
it says :
HTTP Status 404 - /ROOT/servlet/HelloWorld
type Status report
message /ROOT/servlet/HelloWorld
description The requested resource (/ROOT/servlet/HelloWorld) is not available.

Apache Tomcat/4.1.12
instead of getting HelloWorld on the webpage.
Can you plz help me why iam getting this type of error even though the class path is set Email Id is
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Two things
1. You don't have to include ROOT in the URL
2. If you are going to use the /servlet/ClassName method of invoking a servlet you have to have the "invoker servlet" turned on. Tomcat used to be distributed with this function turned on so all the old books and articles assume it.
Look in the /conf/web.xml file for entries related to the "invoker" servlet.
Eric Christensen

Joined: Jul 29, 2002
Posts: 15
William, do you know why they started turning the invoker servlet off?

"No matter how hard you try, you cannot outthink a moron."
Ivan Tamayo
Ranch Hand

Joined: Aug 13, 2001
Posts: 49
They put the invoker servlet off for security reasons
I agree. Here's the link:
subject: Cant run a Servlet
It's not a secret anymore!