This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Tom CAT help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tom CAT help" Watch "Tom CAT help" New topic

Tom CAT help

Ramnath krishnamurthi
Ranch Hand

Joined: Jan 22, 2003
Posts: 56
Hi all,
Am new bee to this space.I am having difficulty in running a simple servlet on Tomcat 4.1.The following are my directory Structures.
TOMCAT_HOME = D:/Program Files/Apache Group/Tomcat4.1
My html fine index.html is in %TOMCAT_HOME%/webapps/greetings
My GreetingServlet.class is in %TOMCAT_HOME%/webapps/WEB-INF/classes
I am calling the GreetingServlet from index.html as
My web.xml looks like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
<!-- Servlet Alias -->
<!-- fully qualified servlet class -->

When i run the index.html and try to call the servlet am getting
404 /greetings/servlet/GreetingServlet not found.

Can anyone tell me what i am missing here??.Is there any other place where i need to register my servlet??.
This code exercise is taken from Profession Java Server Programming from Wrox Publications.
Thanks in advance,
Debashish Chakrabarty
Ranch Hand

Joined: May 14, 2002
Posts: 231

You will need to add a servlet mapping in deployment descriptor of your web-application (web.xml), something like this:

Did it help?
[ July 29, 2003: Message edited by: Debashish Chakrabarty ]

SCJP2, SCWCD 1.4, PMP, ITIL Foundation
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Moving to the Tomcat forum.

"JavaRanch, where the deer and the Certified play" - David O'Meara
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13027

This form of addressing (using /servlet/) requires the invoker servlet - this has to be THE most common problem with Tomcat 4 - look around some of the recent posts for a discussion.
You really should put all servlet and helper classes into a package - it will save you much grief.
[ July 29, 2003: Message edited by: William Brogden ]
I agree. Here's the link:
subject: Tom CAT help
It's not a secret anymore!