You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jiger Java <ji...@hotmail.com> on 2001/09/16 08:44:11 UTC

Tomcat 4 RC 2 doubts

Hi friends,
           This is my first mail to such a wondefull group.Well I just
downloaded Tomcat Rc2 (and tried to convince my boss to use it).
But frankly speaking I found some weird diffiulty installing Rc1 & Rc2.
Now I understand that Tomcat 4 has a major architecture changes like
Custom Classloaders & places to store jar files etc.
But I have some queries hope I will be guided properly.
Doubt No.
1. Since Tomcat 4 uses its own Classloaders it does not recognise the JDK
CLASSPATH variable.Now what do I do if I want a set of libraries which I
have installed in JDK(set in CLASSPATH variable) & also to be used by
tomcat. Putting things in two places wold be cumbersome.Dont youall feel so.
2. If I try to add CLASSPATH in the catalina.bat file along with its
CLASSPATH then TOmcat starts giving out strange errors. For e.g In my app I
was using Custom Tags & appending the classpath in catalina gave me
NoClassDefFound for TagSupport class of JSP when the Sample Custom Tag
example worked normally. How do I integrate JDK classpath with Tomcat
CLASSPATH without any hitches.
3. I am believing that Tomcat no longer allows extraced classes in the lib
dir. only .jars are allowed & all non-jars libraries should be kept in
classes dir. but this is very non-intutive coz it confuses us with servlets
& libraries. Should the pre-Tomcat 4 standard of keeping non-jars in lib &
then brought into CLASSPATH in tomcat.bat/catalina.bat work. Any specific
reasons.

THere are many more doubts guys but please enlighten me with these atleast.

Keep up the good work.
Thanks,
Jiger


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


Re: Tomcat 4 RC 2 doubts

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sun, 16 Sep 2001, Jiger Java wrote:

> Date: Sun, 16 Sep 2001 12:14:11 +0530
> From: Jiger Java <ji...@hotmail.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Tomcat 4 RC 2 doubts
>
> Hi friends,
>            This is my first mail to such a wondefull group.Well I just
> downloaded Tomcat Rc2 (and tried to convince my boss to use it).
> But frankly speaking I found some weird diffiulty installing Rc1 & Rc2.
> Now I understand that Tomcat 4 has a major architecture changes like
> Custom Classloaders & places to store jar files etc.
> But I have some queries hope I will be guided properly.
> Doubt No.
> 1. Since Tomcat 4 uses its own Classloaders it does not recognise the JDK
> CLASSPATH variable.Now what do I do if I want a set of libraries which I
> have installed in JDK(set in CLASSPATH variable) & also to be used by
> tomcat. Putting things in two places wold be cumbersome.Dont youall feel so.

One approach would be to put them where Tomcat needs them (in the "lib"
directory) and adjust your CLASSPATH environment variable to point there.
Then, the JAR files are still in only one place.

Tomcat 3.2 is the last version of Tomcat that supported using the system
CLASSPATH to make libraries available to web apps.  Throughout it's
history, this "feature" has caused a very significant percentage of user
problems and questions on this mailing list (second only to configuing
Tomcat to work with Apache).  With the banishment of the system class
path, this kind of problem has gone to zero -- once you understand the new
policy, it is so simple that nobody makes mistakes with it.  Suffice it to
say that I will *strongly* resist any efforts to make Tomcat 4 import the
system classpath again (of course, you can always modify your own copy of
the "catalina.bat" or "catalina.sh" scripts, but you're on your own to
solve the problems that you are bound to create for yourself).

By the way, if you use Ant to build or run your projects, you don't *ever*
have to worry about classpaths at all -- simply let Ant build them for you
on the fly.  An example of this (for developers of web apps) is documented
in the Application Developer's Guide that is included with Tomcat, and
available online at:

  http://jakarta.apache.org/tomcat/tomcat-4.0-doc/appdev/

> 2. If I try to add CLASSPATH in the catalina.bat file along with its
> CLASSPATH then TOmcat starts giving out strange errors. For e.g In my app I
> was using Custom Tags & appending the classpath in catalina gave me
> NoClassDefFound for TagSupport class of JSP when the Sample Custom Tag
> example worked normally. How do I integrate JDK classpath with Tomcat
> CLASSPATH without any hitches.

Thank you for proving my point -- it is *way* too easy to cause problems
using CLASSPATH :-).

> 3. I am believing that Tomcat no longer allows extraced classes in the lib
> dir. only .jars are allowed & all non-jars libraries should be kept in
> classes dir. but this is very non-intutive coz it confuses us with servlets
> & libraries. Should the pre-Tomcat 4 standard of keeping non-jars in lib &
> then brought into CLASSPATH in tomcat.bat/catalina.bat work. Any specific
> reasons.
>

If you want to use unpacked classes, but make them available to all web
apps, create a "classes" directory under the top-level Tomcat directory,
and put them there (nested in package directories if needed).  The use of
"classes" and "lib" at the global level is exactly like the use of
"/WEB-INF/classes" and "/WEB-INF/lib" inside your web app to allow either
unpacked classes or JAR files.

> THere are many more doubts guys but please enlighten me with these atleast.
>
> Keep up the good work.
> Thanks,
> Jiger
>

Craig McClanahan


Re: Tomcat 4 RC 2 doubts

Posted by Pier Fumagalli <pi...@betaversion.org>.
"Jiger Java" <ji...@hotmail.com> wrote:

> 1. Since Tomcat 4 uses its own Classloaders it does not recognise the JDK
> CLASSPATH variable.Now what do I do if I want a set of libraries which I
> have installed in JDK(set in CLASSPATH variable) & also to be used by
> tomcat. Putting things in two places wold be cumbersome.Dont youall feel so.

Nope, I don't... If in Java2 you are using a "classpath", you are, IMHO,
wrong... Libraries required by the JDK, if shared by multiple stuff should
be in JAVA_HOME/jre/lib/ext...

> 2. If I try to add CLASSPATH in the catalina.bat file along with its
> CLASSPATH then TOmcat starts giving out strange errors. For e.g In my app I
> was using Custom Tags & appending the classpath in catalina gave me
> NoClassDefFound for TagSupport class of JSP when the Sample Custom Tag
> example worked normally. How do I integrate JDK classpath with Tomcat
> CLASSPATH without any hitches.

I don't think you can... The layerization of the class loaders was made
exactly to prevent that... Either put your CLASSPATH jars in the JDK
classpath (JAVA_HOME/jre/lib/ext), or in the Catalina extension
(CATALINA_HOME/lib).

> 3. I am believing that Tomcat no longer allows extraced classes in the lib
> dir. only .jars are allowed & all non-jars libraries should be kept in
> classes dir. but this is very non-intutive coz it confuses us with servlets
> & libraries. Should the pre-Tomcat 4 standard of keeping non-jars in lib &
> then brought into CLASSPATH in tomcat.bat/catalina.bat work. Any specific
> reasons.

It is documented. Relying on CLASSPATH after JDK 1.2 came out is WRONG.
Tomcat 3.x does it because it maintains compatibility with JDK 1.1, but
since in JDK 1.2 the wonderful world of classloaders got a nicer and more
secure, relying still on the deprecated CLASSPATH variable would be stupid.

> THere are many more doubts guys but please enlighten me with these atleast.

I hope they're not an environment variables :)

    Pier