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





--- Comment #52 from Dan Armbrust <[EMAIL PROTECTED]>  2008-08-05 14:19:15 PST 
---
(In reply to comment #50)
> (In reply to comment #49)
> > Curt,
> > 
> > I interpret comment #47 as saying that Tomcat isn't clearing the references
> > properly (it clears some references then reinitializes a class by mistake).
> > Shouldn't be trying to fix *that* instead of simply suppressing the 
> > resulting
> > warning message? Who knows what effects partial reference-clearing will 
> > have on
> > future webapps?!
> 
> If this is a matter of just Tomcat doing the wrong thing, and that it can be
> configured to do the right thing, then why not just say so (and how) in the
> message shown to the user?
> 
> Or does this happen elsewhere than just in web apps inside Tomcat
> 

Tomcat is doing the best job that it can at clearing references.  But what it
doesn't (and can't) know is what a safe order would be to clear the 
references.  It is just walking through the classes that a given classloader
has loaded.  I'm not sure if there is any order, other than random, here.

So, what happens for me is that tomcat nulls out the references inside of the
logfactory class.  Then, it goes off to some other class - in my first example
here it was the org.apache.struts.validator.ValidatorForm class from struts -
and it tries to null out the references inside of that class.

Things break because Tomcat is using reflection to find out what all of the
private fields are inside of each class.  And, surprisingly (to me anyway) the
way that Sun designed the reflection API's - this inadvertently calls the
static init code of the ValidatorForm class again.  Which tries to use the (now
broken) logfactory.

Thats what happens in this portion of the stacktrace:

ValidatorForm.<clinit>() line: 99       
Unsafe.ensureClassInitialized(Class) line: not available [native method]        
UnsafeFieldAccessorFactory.newFieldAccessor(Field, boolean) line: 25    
ReflectionFactory.newFieldAccessor(Field, boolean) line: 122   
Field.acquireFieldAccessor(boolean) line: 918   
Field.getFieldAccessor(Object) line: 899        
Field.get(Object) line: 358     
WebappClassLoader.clearReferences() line: 1616 


Thats just the way reflection works, I guess.  Maybe there is another way to
use the reflection API that would prevent it from rerunning init code of
classes, but I doubt it.  Tomcat doesn't mean to reinitialize classes, but it
happens when they use the reflection API.

Make sense?


-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to