tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 40162] JNDI Environment is null within subthreads in Servlet.destroy()
Date Wed, 15 Jul 2009 02:58:32 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=40162





--- Comment #8 from Konstantin Kolinko <knst.kolinko@gmail.com>  2009-07-14 19:58:30
PST ---
You cannot do what you are trying.

Once a Web Application is stopped, its resources are to be available for
garbage collection, that includes their classloader, context etc. Thus all
references to them in global objects are being cleared.

In your example you expect that the Runnable will obtain the InitialContext
that belongs to the web application. There is a race condition, but in most
cases it won't be able to obtain it, because to get it you should go through
some static methods, use some global lookup table, and the references there are
already cleared.
And even if it can, I think that there is no guarantee that the Context will be
usable at that time.


To dig into the code, see
o.a.naming.java.javaURLContextFactory#getInitialContext() and
o.a.naming.ContextBindings#unbindClassLoader(..)
Well, Mark already mentioned those classes.


I do not know, where "shared" code comes into the play. I do not believe that
moving the code into webapp will fix/workaround this.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


Mime
View raw message