tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerry Ford <jf...@katzenjammer.us>
Subject Re: Newbie needing help in deploying servlet
Date Tue, 06 Jan 2004 23:06:33 GMT
David:

Try this;

In your server.xml, add this context to the Host element:

<Context path="/testapp" docBase="/webapps/testapp"
                         reloadable="true" crossContext="true">

                   <Logger className="org.apache.catalina.logger.FileLogger"
                        prefix="localhost_testapp_log." suffix=".txt"
                        timestamp="true" />

                </Context>

Create your web.xml in testapp/WEB_INF as follows:

<?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>test app</display-name>
   <description>
      My test web application.
   </description>

   <servlet>

      <servlet-name>
         Testservlet
      </servlet-name>

      <servlet-class>
         Testservlet.class
      </servlet-class>

   </servlet>

   <servlet-mapping>
      <servlet-name>invoker</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>


</web-app>

Shutdown and restart Tomcat then direct your browser to:  
http://localhost:8080/testapp/form.html

(If you want your URL to be .../servlet/form.html, replace the asterisk 
with the word servlet in the servlet-mapping element of the testapp 
web.xml file.)

Jerry
David wrote:

> I'm trying tomcat-4.1.24 out and have it up and running ok. But when I 
> try to deploy a new servlet it is not seen (404) by tomcat. I have it 
> like this:
> $CATALINA_HOME/webapps/testapp/form.html
> $CATALINA_HOME/webapps/testapp/WEB-INF/classes/Testservlet.class
> I can access the form.html-page on 
> http://localhost:8080/testapp/form.html but not the servlet on 
> http://localhost:8080/testapp/servlet/Testservlet. If I put the class 
> in $CATALINA_HOME/examples/WEB_INF/classes/ it works ok.
>
> I've restarted tomcat, tried it with and without a web.xml in WEB-INF, 
> tried to add it as a <Context> in server.xml but I still just gets 
> that awful 404...
>
> Could someone give me any hints please?
>
> regards
> /David
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message