You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Caldarale, Charles R" <Ch...@unisys.com> on 2007/08/29 15:41:59 UTC

RE: [OT] CLASSPATH (was Tomcat not starting properly)

> From: Brian Munroe [mailto:brian.e.munroe@gmail.com] 
> Subject: Re: Tomcat not starting properly.
> 
> > The CLASSPATH environment variable should never be used when running
> > Tomcat.  (For that matter, it shouldn't be used in any Java 
> > environment these days.)
> 
> Chuck:  I don't mean to hijack this thread with unrelated topics, but
> can you explain the statement within the parentheses in a little more
> detail?  Thanks!

The biggest problem with CLASSPATH is that it tends to be set and then
forgotten, causing classloading problems during subsequent Java
executions.  The resulting confusion (especially if it involves the
wrong version of a class, rather than just a CNFE) can take ages to
figure out.  It's clearer for everyone involved to specify the exact
path needed on the command line when starting a Java application.
Tomcat is just one example of why CLASSPATH shouldn't be used: we've had
numerous discussions on this list when noobs thought they were "helping"
Tomcat by specifying all sorts of JAR files via the CLASSPATH variable -
all of which resulted in disaster, of course.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] CLASSPATH (was Tomcat not starting properly)

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Markus,

Markus Schiegl wrote:
> are you sure about this CLASSPATH-thing?
>
> a few lines above your quoted line catalina.sh sources/includes
> setclasspath.sh which zaps CLASSPATH ("First clear out the user classpath")

Oh, hey, you're right. Thats what I get for searching for CLASSPATH and
not reading every line of the script.

Tomcat actually blanks-out the CLASSPATH before it re-builds it.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG1bp29CaO5/Lv0PARAsJeAKCNIOV+vW+rREb/EWlXuFryBChetACgl5Sb
R4a4Es9uYgZ6uKrapapi24I=
=kNXm
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] CLASSPATH (was Tomcat not starting properly)

Posted by Markus Schiegl <ms...@schiegl.com>.
Hi chris,

are you sure about this CLASSPATH-thing?

a few lines above your quoted line catalina.sh sources/includes
setclasspath.sh which zaps CLASSPATH ("First clear out the user classpath")

I just remembered it because i had to comment this line "CLASSPATH="
to use my externally set environment variable. This happened before i
got cured using the CLASSPATH env at all :-)

@all: this is no advice for patching tomcat (startup) scripts!

kind regards,
   Markus

Christopher Schultz wrote:
> Brian,
> 
> Brian Munroe wrote:
>> I was always told that Tomcat ignored the CLASSPATH and
>> not to use it.  Maybe that is one of those white lies they tell
>> newbies to alleviate problems? :)
> 
> The CLASSPATH environment variable is certainly not ignored by Tomcat.
> Here's part of the startup script from TC 5.5:
> 
> # Add on extra jar files to CLASSPATH
> if [ -n "$JSSE_HOME" ]; then
> CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:"$JSSE_HOME"/lib/jsse.jar
> fi
> CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/bin/commons-logging-api.jar
> 
> Setting your own CLASSPATH environment variable is a recipe for disaster.
> 
> -chris
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] CLASSPATH (was Tomcat not starting properly)

Posted by Brian Munroe <br...@gmail.com>.
On 8/29/07, Christopher Schultz <ch...@christopherschultz.net> wrote:

>
> The CLASSPATH environment variable is certainly not ignored by Tomcat.
> Here's part of the startup script from TC 5.5:
>
> # Add on extra jar files to CLASSPATH
> if [ -n "$JSSE_HOME" ]; then
> CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:"$JSSE_HOME"/lib/jsse.jar
> fi
> CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/bin/commons-logging-api.jar
>

Hum, yep, your right.

> Setting your own CLASSPATH environment variable is a recipe for disaster.
>

Duly noted.  Thanks Chris and Chuck.

-- brian

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] CLASSPATH (was Tomcat not starting properly)

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brian,

Brian Munroe wrote:
> I was always told that Tomcat ignored the CLASSPATH and
> not to use it.  Maybe that is one of those white lies they tell
> newbies to alleviate problems? :)

The CLASSPATH environment variable is certainly not ignored by Tomcat.
Here's part of the startup script from TC 5.5:

# Add on extra jar files to CLASSPATH
if [ -n "$JSSE_HOME" ]; then
CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:"$JSSE_HOME"/lib/jsse.jar
fi
CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/bin/commons-logging-api.jar

Setting your own CLASSPATH environment variable is a recipe for disaster.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG1Y1a9CaO5/Lv0PARAuKGAJoDn5ZcdO90DeyTx1AQ/n1HBvhkQgCgunMJ
TL5dqRnSv+jV7H915fz5CF0=
=j7HD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] CLASSPATH (was Tomcat not starting properly)

Posted by Brian Munroe <br...@gmail.com>.
On 8/29/07, Caldarale, Charles R <Ch...@unisys.com> wrote:

>
> The biggest problem with CLASSPATH is that it tends to be set and then
> forgotten, causing classloading problems during subsequent Java
> executions.  The resulting confusion (especially if it involves the
> wrong version of a class, rather than just a CNFE) can take ages to
> figure out.  It's clearer for everyone involved to specify the exact
> path needed on the command line when starting a Java application.
> Tomcat is just one example of why CLASSPATH shouldn't be used: we've had
> numerous discussions on this list when noobs thought they were "helping"
> Tomcat by specifying all sorts of JAR files via the CLASSPATH variable -
> all of which resulted in disaster, of course.
>

No kidding.  I was always told that Tomcat ignored the CLASSPATH and
not to use it.  Maybe that is one of those white lies they tell
newbies to alleviate problems? :)

I am not totally new to the Java environment, but I am always looking
for the 'best practice' or the 'industry standard' way of doing
things.  I haven't had many opportunities to write client side
applications with it, so I never really had to muck with CLASSPATH too
much.

thanks for your time

-- brian

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org