tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Chan" <jc...@verity.com>
Subject Re: Servlet and Web.xml confusion
Date Tue, 08 Jan 2002 20:19:10 GMT
Hi...


> Hi,
>
> I have tomcat 4.0.1 running on a Redhat 7.1 system.  I can get the
examples
> servlets working, the ones that come with tomcat.
>
> I installed some simple servlets in webapps/ROOT and they work.  I put one
> in
> $CATALINA_HOME/webapps/ROOT/WEB-INF/classes/hello/HelloServlet2.class
>  and invoked it with
> http://localhost:8080/servlet/hello.HelloServlet2
>
> and it worked fine.
>
> I then installed a servlet in
> $CATALINA_HOME/webapps/hello/WEB-INF/classes/hello/HelloWorld2.class
>
> I put the following web.xml file in WEB-INF/web.xml
> <!DOCTYPE....>
> <web-app>
>   <servlet>
>     <servlet-name>HelloWorld2</servlet-name>
>     <servlet-class>HelloWorld2</servlet-class>
>   </servlet>
>
>   <servlet-mapping>
>     <servlet-name>HelloWorld2</servlet-name>
>     <url-pattern>/HelloWorld2</url-pattern>
>   </servlet-mapping>
> <web-app>
>
> and I tried to invoke this servlet with
> http://localhost:8080/hello/servlet/hello.HelloWorld2
>
> but it didn't work.  I get 404 file not found or whatever.
>
> How do I access this servlet?  What am I doing wrong?
>
> Thanks for the help
>
> Dave

I believe that you need to modify the server.xml to add the context. As it
currently stands, Tomcat has no way of knowing that the directory "hello"
actually exists.

The statement to add (at the minimum) would be something like:

          <Context path="" docBase="hello" debug="0"/>.

Anyhow, hope that helps.

John



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message