Try calling the servlet name instead of the class.  You may need to get
rid of the space in the name.

 

 

-----Original Message-----
From: Kurt L Harless [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 06, 2008 1:14 AM
To: users@tomcat.apache.org
Subject: Newbie: Question about first Servlet

 

Greetings,



Specifics:

Window XP

TomCat 5.5

Java 1.6



Created webapp dirs under;



C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\



Called ch1\WEB-INF\classes



In WEB-INF at created a web.xml file with the following contents;



<?xml version="1.0" encoding="ISO-8851-1" ?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee";

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

            http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";

            version="2.4">

            <servlet>

                        <servlet-name>Chapter1 Servlet</servlet-name>

                        <servlet-class>Ch1Servlet</servlet-class>

            </servlet>

            <servlet-mapping>

                        <servlet-name>Chapter1 Servlet</servlet-name>

                        <url-pattern>/Serv1</url-pattern>

            </servlet-mapping>

</web-app>



In the classes subdir to WEB-INF I compile the following java src
successfully



import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;



public class Ch1Servlet extends HttpServlet

{

            public void doGet(HttpServletRequest request,
HttpServletResponse response)

            throws IOException

            {

                        PrintWriter out = response.getWriter();

                        java.util.Date today = new java.util.Date();

                        out.println("<html> " +

                                        "<body>" +

                                        "<h1 align=center>HF\'s Chapter1
Server</h1>" +

                                        "<br>" + today +

                                        "</body>" +

                                        "</html>");

            }

}



I installed TomCat 5.5 as a windows server and can successfully launch
http://localhost:8080 <http://localhost:8080/>  and get the TomCat
initial
page

Under this page I can select the link for TomCat manager and see under
applications an entry for /ch1



However, when I try to run  <http://localhost:8080/ch1/Serv1>
http://localhost:8080/ch1/Serv1 I get HTTP Status 404 - /ch1/Serv1



Anyone want to help a newbie?







****


****

Reply via email to