You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vincent Stoessel <vi...@digex.net> on 2000/04/10 20:02:43 UTC

REQ: how-to on adding servlets

Can some one give a simple step by step 
for adding a servlet (myServlet.jar) to a standalone
tomcat webserver/servlet engine?

I thought you could just add the .jar file to tomcal/lib,
add the .jar file to the classpath and insert the appropriate
<servlet>/servlet-mapping> tages to the web.xml
and be done but sadly that doesn't seem to be working.
Yes, I am new to this.

-- 
Vincent Stoessel -

Re: REQ: how-to on adding servlets

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Vincent Stoessel wrote:

> Can some one give a simple step by step
> for adding a servlet (myServlet.jar) to a standalone
> tomcat webserver/servlet engine?
>
> I thought you could just add the .jar file to tomcal/lib,
> add the .jar file to the classpath

Almost right .. put it in the WEB-INF/lib directory of the web application you
want to use these servlets in.  For example, to use your servlets in the
"examples" context that is in the default installation, put your JAR files
into $TOMCAT_HOME/webapps/examples/WEB-INF/lib.

NOTE:  Tomcat 3.0, and early versions of 3.1, had problems loading classes
from JAR files in these directories.  The workaround is to get the newest
nightly distribution (http://jakarta.apache.org/builds/tomcat/nightly) or
expand your JAR file into WEB-INF/classes instead.


> and insert the appropriate
> <servlet>/servlet-mapping> tages to the web.xml
> and be done but sadly that doesn't seem to be working.
> Yes, I am new to this.
>

Again, make sure you're editing the web.xml file for the web app you want to
use -- for the "examples" case it would be
$TOMCAT_HOME/webapps/examples/WEB-INF/web.xml.

>
> --
> Vincent Stoessel -

Craig McClanahan