Sorry, I should have been clearer.  

Have you mapped HelloServlet in web.xml?  You can't just drop a servlet into
a directory anymore, especially the default ROOT directory...the default
Invoker servlet (which used to let you just drop a servlet into a directory
and have it work) is disabled by default for security reasons in recent
versions of 4.1.x.  The examples directory has the Invoker servlet enabled,
that's why it works there and not elsewhere.

If you really must enable the Invoker servlet (not recommended, definitely
not for a production machine, so eventually you will have to understand how
to map it in web.xml anyway so you might as well start now), then edit
CATALINA_HOME/conf/web.xml and enable the following by removing the "<!--"
and the "-->", then restart Tomcat:

<!-- The mapping for the invoker servlet -->
<!--
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
-->

The preferred and recommended method is to explicitly map your servlet in
your application's web.xml file, something like:

    <servlet>
        <servlet-name>HelloServlet</servlet-name>
        <servlet-class>
          path.to.my.class.files.HelloServlet
        </servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>HelloServlet</servlet-name>
        <url-pattern>/HelloServlet</url-pattern>
    </servlet-mapping>

For more info check the docs.

John

> -----Original Message-----
> From: Felicia Neff [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 22, 2003 4:58 PM
> To: Tomcat Users List
> Subject: Re: Tomcat configuration problem: JSPs work, servlets don't
> 
> 
> The exact error I get when I try to access
> http://www.mydomain.org/servlet/HelloServlet is:
> 
> HTTP Status 404 - /servlet/HelloServlet
> 
> type Status report
> 
> message /servlet/HelloServlet
> 
> description The requested resource (/servlet/HelloServlet) is not
> available.
> Apache Tomcat/4.1.18
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

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

Reply via email to