Meaningless Drivel is fun!
The moose likes Tomcat and the fly likes Tomcat 5.0.27  Http status 404 Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 5.0.27  Http status 404 Error" Watch "Tomcat 5.0.27  Http status 404 Error" New topic

Tomcat 5.0.27 Http status 404 Error

John Lincoln
Ranch Hand

Joined: Feb 11, 2003
Posts: 192

I am trying to run an example servlet using 5.0.27 and having problems.

I have downloaded Tomcat 5.0.27 and did the initial configuration. The configuration was successfully and could see the tomcat page when i say http://localhost:8080.

Now i am trying to run my own HelloWorld example servlet.


1. I created a folder called FirstProject in webapps folder for my project.

The layout is as shown

|-> helloworldexample.html
|-> WEB-INF(folder)

My web.xml look as shown below

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "">


And the for the application, with new 5.0.27 tomcat version , each application should have its own context file in $CATALINA_HOME/conf/catalina/localhost/.

This is as per info in the url (Please note that for tomcat 5.x, unlike tomcat 4.x, it is NOT recommended to place <Context> elements directly in the server.xml file. Instead, put them in the META-INF/context.xml directory of your WAR file or the conf directory as described above)

I have created FirstProject.xml as my context file and placed in $CATALINA_HOME\conf\catalina\localhost\ and the contents are


Context configuration file for the Tomcat Administration Web App

$Id: admin.xml,v 1.3 2004/02/20 17:09:19 remm Exp $


<Context path="/FirstProject" docBase="C:/Tomcat5.0/webapps/FirstProject/"
debug="0" privileged="true">

<!-- Uncomment this Valve to limit access to the Admin app to localhost
for obvious security reasons. Allow may be a comma-separated list of
hosts (or even regular expressions).
<Valve className="org.apache.catalina.valves.RemoteAddrValve"

<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_admin_log." suffix=".txt"


But when i run
I get following error

HTTP Status 404 - /FirsProject/HelloWorldExample


type Status report

message /FirsProject/HelloWorldExample

description The requested resource (/FirsProject/HelloWorldExample) is not available.


Apache Tomcat/5.0.27

Can someone please tell me what i am doing wrong. Please help.

John Lincoln
Ranch Hand

Joined: Feb 11, 2003
Posts: 192

Solved the problem. It was context in server.xml file Even though the version i am using 5.0.27, it does supports adding context path at the end of the file.

The problem was i used forward slash instead of backward slash bad

I agree. Here's the link:
subject: Tomcat 5.0.27 Http status 404 Error
It's not a secret anymore!