tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vernon Wu <vern...@gatewaytech.com>
Subject Library files
Date Thu, 24 Jan 2002 12:04:24 GMT
Hi,

Our application uses a few existing library files. Some of them, such as xerces and mail,

activation, are already in the Tomcat 4 library directories. After I remove those library
files 
from the webapps/myapp/WEB-INF/lib directory, the application malfunctions. 

Some months ago, Craig McClanahan had one email in regarding of the class visibility 
(see the bottom part of this email). Although it is not the same issue, all libraries shall
be 
visible for all applications installed under the Tomcat by the same token. What I miss 
here? (I have set up the class path included %catalina_home%/common/lib)

Thanks,

Vernon 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Fri, 24 Aug 2001, Ju Yan Jery Qin wrote:

> Date: Fri, 24 Aug 2001 16:58:14 +0800
> From: Ju Yan Jery Qin <jqin@ptc.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Cc: rslifka@home.com, vladgri@hotmail.com
> Subject: Re: How do I make Tomcat include needed jars for my servlet?
>
> First thank Vladimir Grishchenko and Rob S. for your help
>
> But in my case, since our product has its own framework and we just do some
customization. So the directory structure is fixed, it looks like this
> d:\vendor\webapp1\codebase\
> under this directory there are classes used by webapp1
> d:\vendor\webapp1\codebase\
> under this directory there are classes used by webapp2
> The two webapps has many other directories and also they have many similar
classes with the same package name.
>
> In our case,
> server.xml has these entries:
>
>      <Context path="/webapp1"
>                       docBase="d:\vendor\webapp1\codebase"
>                       debug="0"
>                       reloadable="true" >
>       </Context>
>      <Context path="/webapp2"
>                       docBase="d:\vendor\webapp2\codebase"
>                       debug="0"
>                       reloadable="true" >
>       </Context>
> Our developer is used to generate classes in d:\vendor\webapp1\codebase\ and
d:\vendor\webapp1\codebase\
>
> If I can redirect d:\vendor\webappx\WEB-INF\classes to
> d:\vendor\webappx\codebase\ just like symbolic link under UNIX, this
> problem will be resolved. So I wonder if there is a place where we can
> define CLASSPATH in our webapp instead of put our classes in a fixed
> place( although it is relavant to our webapp ). I think this is a good
> feature if implemented.
>

I would suggest, on the other hand, that your developers should learn to
understand the concepts behind web applications, and the features of your
servlet container, instead.

If you want classes visible to only a single web app, they go inside
/WEB-INF/classes or /WEB-INF/lib for that web app.  A huge advantage is
that this architecture is portable to *all* servlet containers, and doing
something wierd in Tomcat to break it would lock apps into running only on
Tomcat (as well as break the servlet spec).

If you want classes visible to more than one web app, every servlet
container provides mechanisms for this (although they vary in details).
For Tomcat, you've got two choices:

* Put your classes on the system CLASSPATH (Tomcat 3.2 only)

* Put your classes in JAR files in the "lib" directory under
  Tomcat's top-level directory.  These are automatically
  made visible to all webapps.

Copying files from where they are developed to where they are deployed is
a trivially simple task to automate -- for example, see the "deploy"
target in the Ant script included in the Application Developer's Guide:

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

and the cost of the extra few bytes is trivial compared to the robustness
of the resulting deployment (i.e. you can still compile in your
development directories without breaking existing running apps :-).

Craig McClanahan





--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message