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 Newbie servlet issues 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 "Newbie servlet issues" Watch "Newbie servlet issues" New topic

Newbie servlet issues

Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
Hi I have installed the Tomcat server and am using Coreservlets book to get along.
In chapter 2, section 8 (2.8 Test Your Setup), I'm running into issues.

Basically what I'm doing is this: I've created a servlet that generates the string "Hello" and can be displayed when this servlet is invoked via a browser. I have successfully compiled this servlet (with Eclipse) and deployed my HelloServlet.class into my C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT\WEB-INF\classes directory.

However, when I invoke this via http://localhost:8080/servlet/HelloServlet, I'm getting Error 404.

What could I be missing here?

Here's my code: (default package (please don't frown))

Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
To answer my own question, I had not enabled the invoker servlet as it was throwing out exceptions.

When I enable the invoker servlet in web.xml, I get exceptions based on the following:
Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name invoker

Did I miss the invoker servlet during installation? I think not, as I'm pretty confident that I did a fairly clean installation. How do I verify that the invoker servlet is present?


P.S. I know that this is more a tomcat specific issue and not really related to JSP/Servlets but I hope someone can answer my Q.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

The book you're reading is excellent but is becoming a bit outdated.

It is strongly recommended by most everyone (including the creators of Tomcat) that you never uncomment the Invoker servlet. Instead, start out right from the beginning with explicit servlet mappings in your deployment descriptor.

For more on the invoker servlet see:

If a working "Hello, World" app would help you to get acquainted with Tomcat and servlet development, I have one on my site that you can have running in seconds (3 mouse clicks if you've already got Tomcat running on your machnie).

Go to and follow the directions for SimpleServlet

This example has an explicit mapping for the one servlet in the application.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
That helped, Ben.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345

Ben, the website helped me too!

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
For anyone in future who might come across this post via a search:

It's true that the Core Servlet books are a bit dated. If you have any questions about information in these books, make sure to check for quick answers.

The authors do an admirable job of keeping the website updated.
subject: Newbie servlet issues
Similar Threads
simple problem
where to put servlets? (searched 1st)
problem while running servlet
tomcat can't find index.jsp
Need help