On Tue, 11 Feb 2003, John Espey wrote:

> Date: Tue, 11 Feb 2003 15:44:09 -0600
> From: John Espey <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: RE: [OT]  -   ServletContextListener
>
> Craig,
> Upon further inspection, it appears that the Thread initializing our
> Listeners has the wrong contextClassLoader, but the thread invoking each
> method DOES have the correct loader.  Is there a logical reason you can
> think of to explain why BEA did it this way?  This still seems like a bug to
> me......

Well, from a container developer's perspective, the code that invokes a
ServletContextListener is in a completely different place than the code
that invokes a servlet.  So, it's really easy to visualize that the person
who added a Thread.getCurrentThread().setContextClassLoader() in one place
forgot to add it in the other ...

Bottom line -- it's much more likely that this was an oversight than that
it was a deliberate design choice.  That has certainly the case for Tomcat
in a few corner cases like this.

> Thanks

Craig

>
> > -----Original Message-----
> > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 11, 2003 2:49 PM
> > To: Struts Users Mailing List
> > Subject: Re: [OT] - ServletContextListener
> >
> >
> >
> >
> > On Tue, 11 Feb 2003, John Espey wrote:
> >
> > > Date: Tue, 11 Feb 2003 14:25:58 -0600
> > > From: John Espey <[EMAIL PROTECTED]>
> > > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > > To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > > Subject: [OT]  -   ServletContextListener
> > >
> > >
> > > Does anybody know if the container should be setting the
> > contextClassLoader
> > > on the current thread when it loads the various listeners configured in
> > > web.xml?
> > >
> > > The particular behavior we're seeing is that the
> > contextClassLoader for the
> > > thread launching our listeners (both context and session) is
> > not a weblogic
> > > specific loader (whereas other classloaders are).  This causes
> > a problem for
> > > us because we have our own commons log factory that we use, but
> > because we
> > > specify this in a property file in our web app, the listeners
> > are using a
> > > contextClassLoader that doesn't have access to the web app, which causes
> > > commons to default to using simpleLog or whatever the default is.
> > >
> >
> > Yes, listeners should be configured with the thread context class loader
> > set to the webapp's class loader.
> >
> > Note that the specific requirement to provide a per-thread context class
> > loader at all is in the J2EE Platform Spec (Section J2EE.6.2.4.8), not in
> > the servlet spec.  Although there is no specific mention of listeners (as
> > opposed to any other class), it makes no sense to make it available for
> > some components (servlets and filters) and not others.
> >
> > >
> > > I know a lot of you are familiar with the Servlet spec (or
> > wrote it in some
> > > cases ;)    Can anybody tell me if this might be a bug in
> > weblogic or if it
> > > is the expected behavior (or best case, point me to some
> > documentation that
> > > will explain the way this should work in a web container)
> > >
> >
> > I would report it a WebLogic bug.  ISTR a similar sounding bug in Tomcat
> > 4.1.x as well, but *think* that that's been fixed.
> >
> > >
> > > Thanks
> > >
> >
> > Craig
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to