https://issues.apache.org/bugzilla/show_bug.cgi?id=57172
--- Comment #2 from Joern Huxhorn <jhuxh...@googlemail.com> --- How about indicating that the web application is trying to use the web application class loader after it has been stopped instead of throwing a non-descriptive NPE? The webapp in question was simply using a Java 8 forkjoin. at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1540) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) at java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:747) at java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:721) at java.util.stream.AbstractTask.compute(AbstractTask.java:316) at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:902) at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1689) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1644) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) Are you seriously suggesting that leaving the current behavior is preferable to, say, a proper error message? Beside that: the webapp behaved like that without being stopped. This is related to undeploy magic performed by Tomcat regarding ThreadLocal and this problem shows up after RE-deploying an application without restarting Tomcat. As I mentioned in my original report: if you search for this on the web then you'll find mentions of similar problems from 2006. I can't be sure since they just refer to generic NPE's in the findResources method spread over various Tomcat versions. If you consider the usage of a ThreadLocal a memory leak in our app then, yes, we have a memory leak. I, on the other hand, would argue that it's the responsibility of the application server to shield web-applications from leaks like that by using separate worker threads for each webapp. I'm fully aware how this is supposed to work. But it isn't. I just observed this NPE in a live web application. Alright. Let's settle for a compromise. Just add if(resources == null) { throw new IllegalStateException("OMG! SNAFU! This can't happen! findResources has been called on a (probably) stopped web context! /o\\"); } This would be easier to search for than a simple NPE and would probably prove my point in the future. -- 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