Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Tomcat 5.0.27 Http status 404 Error

Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic