There are a couple of related discussions going on on the Jakarta commons-dev mailing list where I'd like to invite the classloading gurus from the JBoss community to weigh in:
These discussions center on a proposal to change commons-logging to use a static binding approach; i.e. one wherein a user who wished to log using log4j would deploy a "commons-logging-log4j.jar" whose "discovery" mechanism would be statically bound to log4j. This approach would replace the existing implementation where JCL uses the thread context classloader to try to dynamically determine what logging library to use.
The static binding approach is simpler and more reliable, but has the disadvantage of not allowing a contained deployment to override the logging configuration of its container if parent-first classloading is used.
The following quote from Simon Kitching sums up the argument for using static binding:
There simply *is* no requirement to be able to deploy the static adaptor lib via one classloader but deploy the actual logging library via another. This isn't something that anyone needs to do.
(a) if child-first loading is in operation, then the static adaptor and
the logging library can both be deployed via WEB-INF/lib.
(b) if parent-first loading is in operation and no static adaptor is
present in the parent, then the static adaptor and the logging library
can both be deployed via WEB-INF/lib.
(c) if parent-first loading is in operation, and a static adaptor +
logging library are deployed via the parent, then the webapp has no
control. If they want control, they should use child-first [see scenario
Where it would be great to get some input from the JBoss folks is on the implications of the last statement above -- if a contained application wants to use a different logging library than its container, it should just use child-first classloading. Any thoughts on problems JCL users might experience from using child-first loading, particularly if the deployment in question isn't a webapp, but is an EJB jar or a SAR? Why is parent-first loading the default in JBoss, even for webapps?
Sorry if this is off-topic; didn't see a user forum that really fit :)