logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Randall <javabr...@gmail.com>
Subject Re: bizarre NPE exception
Date Fri, 20 Nov 2009 03:59:30 GMT
Hi Pat,

In the case of your first stack trace I was referring to the static variable
declared at line 71 of
http://svn.apache.org/viewvc/logging/log4j/tags/v1_2_15/src/main/java/org/apache/log4j/helpers/AbsoluteTimeDateFormat.java?view=markup:

private static char[] previousTimeWithoutMillis = new char[9]; //
"HH:mm:ss."

I think you'll find it is the culprit in the first stack trace.  That said,
I believe the nature of this bug is that it can occur on any static member
which is nulled during Tomcat classloader disposal with a webapp reload as
per the bug already mentioned.

Is this only occurring during hot-redeploys of a WAR-file?  What ultimate
impact is it having on the production webapp? Is the exception being thrown
from a dying webapp thread? Is that thread's lifecycle being properly
managed i.e. if DbC:Person is a thread started by the webapp, is there a
context listener to shut it down when the webapp is undeployed? Nothing will
cause these sorts of problems quite like an unterminated thread whose
classloader is that of the unloaded webapp.

Brett

On Thu, Nov 19, 2009 at 5:41 PM, Pat Farrell <pfarrell@pfarrell.com> wrote:

> Brett Randall wrote:
> > You mentioned that this problem occurs when deploying a new WAR file -
> that
> > would agree with aforementioned likely classloader disposal problems. And
> it
> > currently agrees with your stack traces and the NPE you are seeing, which
> > looks to relate to a static char[] in that class, which is caching the
> time
> > in HH:mm:ss format for performance reasons.
>
> Interesting, the "that class" is one of the legacy Tomcat classes,
> right? there are no static char[] in my code near there.
>
> I've changed over to EnhancedPatternLayout, and that is not sufficient
> to make it go away, I'm still getting NPE.
>
> Exception in thread "DbC:User"
> java.lang.NullPointerException
>        at org.apache.log4j.spi.LocationInfo.<init>(LocationInfo.java:112)
>        at
>
> org.apache.log4j.spi.LoggingEvent.getLocationInformation(LoggingEvent.java:247)
>        at
>
> org.apache.log4j.pattern.LineLocationPatternConverter.format(LineLocationPatternConverter.java:58)
>        at
>
> org.apache.log4j.pattern.BridgePatternConverter.format(BridgePatternConverter.java:119)
>        at
>
> org.apache.log4j.EnhancedPatternLayout.format(EnhancedPatternLayout.java:533)
>         at
> org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:302)
>        at org.apache.log4j.WriterAppender.append(WriterAppender.java:160)
>        at
> org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
>        at
>
> org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
>        at org.apache.log4j.Category.callAppenders(Category.java:206)
>        at org.apache.log4j.Category.forcedLog(Category.java:391)
>         at org.apache.log4j.Logger.trace(Logger.java:172)
>        at
>
> com.pfarrell.utils.collections.DatabaseCache.makeRefreshString(DatabaseCache.java:148)
>        at
>
> com.pfarrell.utils.collections.DatabaseCache.refreshValues(DatabaseCache.java:161)
>        at
>
> com.pfarrell.utils.collections.DatabaseCache.processAll(DatabaseCache.java:126)
>        at
>
> com.pfarrell.utils.collections.WorkingSetCache.run(WorkingSetCache.java:159)
>         at java.lang.Thread.run(Thread.java:619)
> Exception in thread "DbC:Person"
> --
> Pat Farrell
> http://www.pfarrell.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message