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

Small Tomcat configuration problem

Jacob Thomas
Ranch Hand

Joined: May 06, 2003
Posts: 51

I have installed Apache Tomcat/5.5.15 on my machine. Followed the installation steps detailed on site. Got it up and running. I am able to see the homepage of the Tomcat server. Also, I am able to run all the example servlets and jsps in the webapps directory.

However, when I try to create and access the sample Beer web application given in chapter 3 of Head First Servlets and JSP book, I get a 404 Error. As detailed in the book, I have created the Beer-v1 directory under webapps directory. But this application works if I move the folder to servlet-examples and access it using the following URL:


Could anybody please reason this strange behaviour? Thanks!

PS: I have configured the Tomcat server to be running on port 9090
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
When you have placed your Beer-v1 directory in webapps, then by what url you have accessed it?

[ July 27, 2006: Message edited by: Naseem Khan ]

Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Jacob Thomas
Ranch Hand

Joined: May 06, 2003
Posts: 51
I accessed it using this URL:


I guess it's correct.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

In order for Tomcat to treat a directory under webapps as a webapp, it must contain a WEB-INF directory.

Create that directory, then restart Tomcat, and retry.

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

Joined: May 06, 2003
Posts: 51
Thanks very much Ben. It did the trick!!! I was trying out the example in Head First Servelts and JSP book. I didn't create the entire folder structure before trying out the static html page. I created the WEB-INF folder as you said and it worked!!!
I agree. Here's the link:
subject: Small Tomcat configuration problem
It's not a secret anymore!