aspose file tools*
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Newbie servlet issues" Watch "Newbie servlet issues" New topic
Author

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))


Thanks,
Sashi
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?

Thanks,
Sashi

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
Sheriff

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:
http://faq.javaranch.com/view?InvokerServlet


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 http://simple.souther.us 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.
Thanks.
Sashi
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9629
    
    2

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 www.coreservlets.com for quick answers.

The authors do an admirable job of keeping the website updated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Newbie servlet issues