https://issues.apache.org/bugzilla/show_bug.cgi?id=40162





--- Comment #8 from Konstantin Kolinko <knst.koli...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to