ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Java Web Applications
Subject:   HTTP Status 404
Date:   2005-02-17 04:46:39
From:   Doro
hi
Im having hard time trying to browse the following servlet. Here is the error it outputs.


HTTP Status 404 - /jktomcat/200100809/WEBINFO/classes/project/servlet/HelloServlet
type Status report


message /jktomcat/200100809/WEB-INFO/classes/project/servlet/HelloServlet


description The requested resource (/jktomcat/200100809/WEB-INFO/classes/project/servlet/HelloServlet) is not available.


the servlet is as follows



package project;


import java.io.*;



import javax.servlet.http.*;
import javax.servlet.*;


public class HelloServlet extends HttpServlet {
public void doGet (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out = res.getWriter();


out.println("Hello, world!");
out.close();
}
}



the xml file is
<?xml version="1.0" encoding="ISO-8859-1"?>


<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">


<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>project.HelloServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/servlet/project/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>


the directory
csweb\jktomcat\200100809\WEBINFO\
web.xml
classes
project\HelloServlet.class
lib
"library file that came with Tomcat"



i compiled the program outside the tomcat environment and and copied the class file into the project package. it compiled succefully.