On Tue, 15 Jan 2002, Donnie Hale wrote:
> Date: Tue, 15 Jan 2002 22:05:56 -0500
> From: Donnie Hale <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: RE: Bad classloading,
> why does Struts continue to use Class.forName()?
>
> Craig,
>
> I thought the context classloader was defined to be the same as the loader
> you'd get via "class.forName" if the context classloader had not otherwise
> been explicitly set. From the javadocs for getContextClassLoader:
>
> ========================
> Returns the context ClassLoader for this Thread. The context ClassLoader is
> provided by the creator of the thread for use by code running in this thread
> when loading classes and resources. If not set, the default is the
> ClassLoader context of the parent Thread. The context ClassLoader of the
> primordial thread is typically set to the class loader used to load the
> application.
> ========================
>
> Maybe I'm reading too much into that. What I'm surmising is that servlet 2.2
> environments which don't properly use a classloader delegation chain will
> still implicitly have a usable context classloader. Am I missing something?
>
Possibly ... there are really three possible cases:
(1) The context class loader is set to null. OK, we can default back to
Class.forName() in that scenario.
(2) The context class loader is set to be the web application class
loader (required in 2.3, but the 2.2 spec is silent). If we could depend
on this, it would be great -- we'd just use this class loader everywhere
that Struts currently calls Class.forName(), and it wouldn't matter
whether struts.jar itself was loaded from /WEB-INF/lib or not.
(3) The context class loader is set to something else -- perhaps to
whatever internal class loader was last required by this particular
thread. In this scenario, the behavior of Digester and the rest would
become undefined -- and there's no good way for Struts to distinguish
between this and case (2) :-(.
> Donnie
>
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>