On 2/19/06, Simon Kitching <[EMAIL PROTECTED]> wrote: > On Sun, 2006-02-19 at 00:46 +0000, [EMAIL PROTECTED] wrote: > > Author: mmarinschek > > Date: Sat Feb 18 16:46:18 2006 > > New Revision: 378805 > > > > URL: http://svn.apache.org/viewcvs?rev=378805&view=rev > > Log: > > minor changes in application-factory, fixed "readOnly" referral in > > HtmlRendererUtils > > > > Modified: > > > > myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationFactoryImpl.java > > > > Modified: > > myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationFactoryImpl.java > > URL: > > http://svn.apache.org/viewcvs/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationFactoryImpl.java?rev=378805&r1=378804&r2=378805&view=diff > > ============================================================================== > > --- > > myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationFactoryImpl.java > > (original) > > +++ > > myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationFactoryImpl.java > > Sat Feb 18 16:46:18 2006 > > @@ -29,12 +29,14 @@ > > public class ApplicationFactoryImpl > > extends ApplicationFactory > > { > > - private static final Log log = > > LogFactory.getLog(ApplicationFactory.class); > > + private static final Log log = > > LogFactory.getLog(ApplicationFactoryImpl.class); > > > Just a warning to all developers: when using commons-logging in a > library, STATIC fields must **NOT** be used to store Log objects. > > The problem is that the class may be called with various thread-context > classloaders (TCCL) set. However the class is only ever loaded once.
Never heard of that. Simon are you really sure? I think the opposite is true. Containers tend to have Classloaders that all have there own set of loaded classes. So you get problems when your applications Classloader holds some Classes that the container itself has already loaded. Then you get such things like "incomptible class" Exceptions and NoClassDefFound when a class in your webapp is linked to another class in your app but the Loader finds the containers class first. Manfred > If the Log object is static, then it is initialised using the TCCL of > the very first webapp to use it (ie which forces the class to be loaded) > - including picking up config info from that TCCL. All other webapps > will then use the same Log object - which is not healthy. > > Yes this is a nuisance, but it's absolutely necessary to avoid storing > Log instances in static fields for libraries like MyFaces. > > Regards, > > Simon > >