cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: re loading of classes in tomcat 3.2b4 is _sloooooow_@6
Date Tue, 26 Sep 2000 17:13:10 GMT
Aaron Mulder wrote:

> On Mon, 25 Sep 2000, Craig R. McClanahan wrote:
> > The third advantage is that some libraries will not work correctly unless they
> > are installed in the webapp.  I believe Cocoon has run into this -- I'll
> > describe what I ran into with Struts because it's similar.
> >
> > Struts includes a module called Digester (very similar to the XmlMapper that is
> > used inside Tomcat to configure itself from the server.xml and web.xml files).
> > One of the things you can do is create a new object when a particular XML
> > element is encountered.  But, if the digester classes are loaded from the
> > system class path, and the Java class of the object you're trying to create is
> > in the webapp (a very typical case), you're out of luck --
> > ClassNotFoundException because the Digester tries to use the classloader it was
> > itself loaded from (i.e. system class loader).
>
>         This can be solved by judicious use of the
> Thread.contextClassLoader under 1.2.  Of course, the library has to
> support that, but Tomcat should already: under 3.2 at least there's the
> Jdk12Interceptor that would set the contextClassLoader for all calls - I
> assume 4.0 has something similar.
>

Tomcat 4.0 has the luxury of assuming a Java2 platform (courtesy of the servlet
2.3/JSP 1.2 specs saying so), so it doesn't need to be in an optional interceptor.
Yes, Tomcat 4.0 sets the context class loader (to the webapp's classloader) as soon
as it knows what context will handle this request.

And yes, it allows properly programmed libraries to work correctly, even if they are
installed on the shared class path, as long as they also assume a Java2 base platform
(context class loader was added in JDK 1.2).

>
> Aaron
>

Craig McClanahan


>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

--
====================
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



Mime
View raw message