cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Haraburda <>
Subject RE: CocoonSerlvet Patch (init-classloader param)
Date Thu, 06 Jun 2002 18:52:19 GMT
Hi Carsten,

On Thu, 2002-06-06 at 07:31, Carsten Ziegeler wrote:
> Hi David,
> I don't now the problem, but as far as I can tell, the init-classloader
> param is evaluated. In CocoonServlet, line 306 (current CVS):
>         this.addClassDirs = "true".equalsIgnoreCase(value) ||
> "yes".equalsIgnoreCase(value);
> and this boolean is used at several places throughout the servlet class.
> So, what does your patch change?
> Carsten

This parameter is evaluated, but it is only used when the servlet is
checking to see if it should "build its own classpath" (something I
don't think it should be doing anyway).  Regardless of what the
init-classloader parameter is set to, user-level code will always be
executed with the RepositoryClassLoader, which breaks JNDI in Tomcat. 
Take a look at line 936 of (the latest CVS revision):

/* HACK for reducing class loader
problems.                                     */
/* example: xalan extensions fail if someone adds xalan jars in
tomcat3.2.1/lib */
try {
} catch (Exception e){}

The ContextClassLoader is set, regardless of the init-classloader
parameter.  My patch (attached) simply adds checks for this parameter,
here and a few other needed places -- although I would like to emphasize
that I think this should be considered a temporary solution, because
(just to reiterate :-), the Java API docs imply that it is a Thread's
creator's responsbility to set the ContextClassLoader (which Tomcat does
appropriatley), and the J2EE spec also states that this is the
container's responsibility (which again would be Tomcat) -- so
certainly, although RepositoryClassLoader is obviously needed for
internal purposes, it should never be there when user-level code is
being executed.  But apparently there were/are some very strange class
loading issues that prompted this "HACK"... does anyone know what they



View raw message