tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Claxton <>
Subject problem with classpath modification
Date Thu, 20 Feb 2003 05:51:34 GMT
We encountered an issue when adding a classpath entry to the
'' script.  Our environment is RH Linux 8, Apache 2.0, and
Tomcat 4.1.18.  We have connected Apache and Tomcat, and moved our appbase
to another folder (not $TOMCAT_HOME/webapps).

We need to add a classpath entry in order to help our servlet *find
itself*.  This sounds a bit funny, but the servlet reads a config file, and
parses its own tag library.  In a traditional environment we would set an
entry in the classpath for our servlet, and a couple dependent jar files.
In our Tomcat 4.x environment, such configuration is done through XML
files.  As it is, a 'HelloWorld' servlet runs fine in our  'classes'
folder, and dependent jar files can be found in our 'lib' folder.  But our
own servlet cannot *find itself* to bootstrap the tag library.

So we tried to add the entry '/home/web/mediaware/WEB-INF/classes' to the
CLASSPATH by modifying the '' script.  But it caused us to
get various 500 errors - the supporting classes could not be found!  Even
the 'HelloWorld' servlet cannot be found.

To overcome this issue, we make the following modification in the
'' file (the 'joinClassPath' function assures that any
existing classpath is inherited, and that there are no null entries in the

# Set standard CLASSPATH
# CLASSPATH="$JAVA_HOME"/lib/tools.jar

joinClassPath() {
        # adds string argument to end of existing classpath
        if [ -z "$CLASSPATH" ] ; then
        export CLASSPATH=`echo $CLASSPATH | tr '::' ':'`

joinClassPath "$JAVA_HOME"/lib/tools.jar
joinClassPath "$TOMCAT_HOME"/common/lib/servlet.jar
joinClassPath /home/web/mediaware/WEB-INF/classes
joinClassPath /home/web/mediaware/WEB-INF/lib/activation.jar
joinClassPath /home/web/mediaware/WEB-INF/lib/collections.jar
joinClassPath /home/web/mediaware/WEB-INF/lib/mail.jar

A test servlet, located in our 'classes' folder displays the resulting
classpath as follows:

Output - The classpath is: 

With this change, our servlet runs fine, and is able to *find itself*
(using the 'classes' entry).  But the question is this: all our servlet
really needs to see is its own directory in the classpath - why does adding
this single entry to our classpath cause Tomcat to fail to find our
supporting jar files, and especially its own servlet jar!  Why is it
necessary for us to forcibly tell Tomcat the classpath for our jar files,
which are sitting in our web application folder (literally under

Thanks in advance.

        Regards, Bill Claxton []
        OpenAsia Solutions provides streaming media & payment solutions.
        Check out

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message