Bug 32330 - JspC changes context classloader
Summary: JspC changes context classloader
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 5.0.28
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
: 29904 (view as bug list)
Depends on:
Reported: 2004-11-20 17:17 UTC by Peter Doornbosch
Modified: 2005-05-05 13:24 UTC (History)
2 users (show)

fix for this bug: set back original ClassLoader just before returning from processFile() (1.60 KB, patch)
2004-11-20 17:20 UTC, Peter Doornbosch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Doornbosch 2004-11-20 17:17:34 UTC
In JspC the context classloader is set (initClassLoader() in processFile()), but
never reset to the original. This may cause serious (and hard to find ;-))
classloader trouble when JspC is used as an Ant task. For example, in my case
ant crashes during an xdoclet task (!) that is executed after the jspc task with
the following message: Class org.apache.commons.logging.impl.Jdk14Logger does
not implement Log.

I think the fix is fairly simple: just set back the original classloader after
JspC is done - that is, for me this works fine. I'll attach a patch.

Peter Doornbosch
Luminis - The Art of Software Engineering
web: http://www.luminis.nl
Comment 1 Peter Doornbosch 2004-11-20 17:20:06 UTC
Created attachment 13509 [details]
fix for this bug: set back original ClassLoader just before returning from processFile()
Comment 2 Yoav Shapira 2004-11-22 15:55:01 UTC
Not only is this good for your issue, it solves another one which I'd close as 
not reproducible.  So this is great.  Thank you for submitting this patch.

Done for 5.5.5 and 5.0.30.
Comment 3 Yoav Shapira 2004-11-22 15:55:32 UTC
*** Bug 29904 has been marked as a duplicate of this bug. ***