File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Servlets don't start in tomcat 4.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Servlets don Watch "Servlets don New topic

Servlets don't start in tomcat 4.1

A. Mazon

Joined: May 16, 2002
Posts: 4
I am trying to make some tests using servlets in Tomcat 4.1.18 but I recieved an error and I can't figure out why.

The error is the 404. I have my servlet class in the directory "webapps\mywebapp\WEB-INF\classes\mypackage\"
And I am trying to access it using the following URL: "http://localhost:8080/mywebapp/servlet/mypackage.ServletName
but it doesn't work . I was using some examples from a book but those dont work either.
Does anybody know what am I doing wrong? Since I can load the servlet examples that come with Tomcat I guess I am missing something.
Thank you in advance.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
We get this one alot!
In order to use the /servlet/ style of addressing a servlet you need to have the "invoker" servlet turned on in the particular web application. See the web.xml in the examples to see it in use.
The /servlet/ thing is supposed to be a "convenience" item and was turned on by default in Tomcat for earlier versions. In the current version it is turned off. Look also at the web.xml in /conf
A. Mazon

Joined: May 16, 2002
Posts: 4
Hi Bill,
I decided to use Tomcat 4.0 which is the version that comes with the CD I have and it is working fine. I will have to read the documentation to try to make the things work in the 4.1 version but for now I am ok with the old one.
Thank you!
Louise Haydu
Ranch Hand

Joined: Aug 17, 2000
Posts: 51
I just downloaded and installed Tomcat 4.1.24 and am also receiving 404 errors when I attempt to run servlets.
The "invoker" tags are not commented out in the config\web.xml file.
Here's info on my problem:
servlet class location: "webapps\chapter01\WEB-INF\classes\HelloWorldServlet.class"
web.xml: contains tags to define the HelloWorldServlet
URL used to access: "http://localhost:8080/chapter01/servlet/HelloWorldServlet"
I am using the SCWCD Exam Study Kit book, which contains a CD that has complete workable files for this HelloWorldServlet.
So I decided to use install the Tomcat 4.0 version supplied on the CD in the book and now everything works fine.
Does anyone have any additional insight on the problems I experienced with Tomcat 4.1.24?
Louise Haydu
Ranch Hand

Joined: Aug 17, 2000
Posts: 51
I found my problem... when I looked in the conf\web.xml file, I wasn't looking in the right place for the "invoker" tags. The tags that need to be uncommented are as follows:
<!-- The mapping for the JSP servlet -->
Everything is working fine now!
I agree. Here's the link:
subject: Servlets don't start in tomcat 4.1
jQuery in Action, 3rd edition