Do you have a <servlet-mapping> in your web.xml

Something like this might do for you(Change the "MyClass" value accordingly)


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

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd";>

<web-app>
  <display-name>MyClass</display-name>
 
  <servlet>
    <servlet-name>MyClass</servlet-name>
    <servlet-class>MyClass</servlet-class>
  </servlet>
  
  <servlet-mapping>
    <servlet-name>MyClass</servlet-name>
    <url-pattern>/servlet/MyClass</url-pattern>
  </servlet-mapping>
  
</web-app>

~Sumit


-----Original Message-----
From: George Metz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 4:35 PM
To: [EMAIL PROTECTED]
Subject: new user: servlets dont run in new apps


what simple thing am i missing ?
(probably something in the documentation, but i havent
found it so far)

PROBLEM:
cannot get servlets to run in a NEW webapp. the ones that
come with tomcat work ok, except for the sample servlet in the
Developer's Guide. this built-in one doesnt run either:

http://127.0.0.1:8080/tomcat-docs/appdev/sample/web/hello
(gives: HTTP Status 404
  The requested resource (/tomcat-docs/appdev/sample/web/hello) is not
available

As for my new apps:
- a simple html page in webapps\george runs ok

- a tomcat example jsp i modified and dropped into webapps/george/Jsp
runs fine.
   called thusly:
 http://127.0.0.1:8080/george/Jsp/geo_hello.jsp?yakittyyak

- i successfully copied/renamed/modified/compiled and ran a servlet
under
 examples\WEB-INF\classes,  even referenced it successfully in
 examples\WEB-INF\web.xml like so :

    <servlet>
        <servlet-name>georghe</servlet-name>
        <servlet-class>GeorgeHello</servlet-class>
    </servlet>

 works like a champ when called thusly:
http://127.0.0.1:8080/examples/servlet/GeorgeHello?username=CletusT
or
http://127.0.0.1:8080/examples/servlet/georghe?username=CletusT

 BUT same GeorgeHello class servlet placed under
webapps\george\WEB-INF\classes
 wont run. gives the dreaded 404

HTTP Status 404
The requested resource (/george/servlet/GeorgeHello) is not available


Have same problem with David Flanagan's (OReilly) javaexamples2
app (installed it from a .war file, tomcat extracted it).
JSPs run fine, servlets dont.

(george app directories were set up manually, but carefully.
 have checked permissions/properties on the directories several
 times. look the same as the examples app to me. )


thanks!
George





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to