You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Balcom, Mimi <mb...@consilient.com> on 2000/10/03 21:09:30 UTC

Tomcat classloader

Hi,

   Does any one know if there is a way to have tomcat classloader loads
classes from a servlet repository (Web-inf/lib) 
   before it loads from system, or Tomcat's classpath? without changing
Tomcat source.

Thanks in adv.


Mimi Balcom
Consilient Software Inc. www.consilient.com
1815 Fourth St.  Berkeley, CA 94710
510-981-9200 (office) 510-981-9700 (fax)



Re: Tomcat classloader

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Balcom, Mimi wrote:

> Hi,
>
>    Does any one know if there is a way to have tomcat classloader loads
> classes from a servlet repository (Web-inf/lib)
>    before it loads from system, or Tomcat's classpath? without changing
> Tomcat source.
>

The classloader in Tomcat 4.0 works in this manner, consistent with the
new
requirements for class loaders of the Servlet 2.3 specification.

There is a document in the source distribution
(catalina/docs/dev/classloaders.html) that discusses the overall class
loading architecture employed in Tomcat 4.0.

>
> Thanks in adv.
>
> Mimi Balcom

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

Re: Tomcat classloader

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

> cmanolache@yahoo.com wrote:
> >
> > >    Does any one know if there is a way to have tomcat classloader loads
> > > classes from a servlet repository (Web-inf/lib)
> > >    before it loads from system, or Tomcat's classpath? without changing
> > > Tomcat source.
> >
> > This is not possible in tomcat 3.1 or 3.2 - unless you replace the loader
> > ( it is possible to do that quite easily if you want to - and implement
> > whatever policy you want )
> >
> > In tomcat 3.3 it will be possible to have a separate class loader for
> > tomcat.core ( the server ) and each context, but for the default we'll
> > still strictly follow the rule that parent class loader is called before
> > child class loader.
> >
>
> In addition to the core and context classloader I would like to see a
> global context classloader.  A place where you can install jar's or
> classes that should be made available globally to all contexts, and
> where you can set a different security policy than for tomcat core.
>

The Tomcat 4.0 classloader works exactly as you describe:

* The Catalina internal classloader is built from the JAR files in
  $CATALINA_HOME/server.

* The shared classloader that is the parent of all webapp class
  loaders is built from the JAR files in $CATALINA_HOME/lib.

* The webapp class loaders are built from their own WEB-INF/classes
  and WEB-INF/lib directories.

Once Tomcat 4.0 supports running under a security manager (real soon now :-),
you'll be able to use different policy protections for these different sources
of classes.

>
> Glenn
>

Craig

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Re: Tomcat classloader

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
cmanolache@yahoo.com wrote:
> 
> >    Does any one know if there is a way to have tomcat classloader loads
> > classes from a servlet repository (Web-inf/lib)
> >    before it loads from system, or Tomcat's classpath? without changing
> > Tomcat source.
> 
> This is not possible in tomcat 3.1 or 3.2 - unless you replace the loader
> ( it is possible to do that quite easily if you want to - and implement
> whatever policy you want )
> 
> In tomcat 3.3 it will be possible to have a separate class loader for
> tomcat.core ( the server ) and each context, but for the default we'll
> still strictly follow the rule that parent class loader is called before
> child class loader.
> 

In addition to the core and context classloader I would like to see a
global context classloader.  A place where you can install jar's or
classes that should be made available globally to all contexts, and
where you can set a different security policy than for tomcat core.

Glenn
 
----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

Re: Tomcat classloader

Posted by cm...@yahoo.com.
>    Does any one know if there is a way to have tomcat classloader loads
> classes from a servlet repository (Web-inf/lib) 
>    before it loads from system, or Tomcat's classpath? without changing
> Tomcat source.

This is not possible in tomcat 3.1 or 3.2 - unless you replace the loader 
( it is possible to do that quite easily if you want to - and implement
whatever policy you want )

In tomcat 3.3 it will be possible to have a separate class loader for 
tomcat.core ( the server ) and each context, but for the default we'll
still strictly follow the rule that parent class loader is called before
child class loader.


Costin