You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Joe Niski <jo...@yahoo.com> on 2004/02/04 01:40:10 UTC

NullPointerException from MDC in IBM WSAD 5.1/WebSphere 5.0.2

Greetings:

I'm using IBM's WSAD 5 and the embedded Websphere 5
runtime environment. The web project in my enterprise
app contains a servlet that uses the DOMConfigurator
to configure Log4j and then log a message that
configuration succeeded. The log4j.jar (version 1.2.8)
is in WEB-INF/lib.

My ConversionPattern for the PatternLayout class
contains this pattern: 

[USERID]%X{USERID}[MESG]%m

In WSAD 5.0.1 with Websphere 5.0.0 s0245.03, the code
runs fine. Since my servlet code doesn't set a
"USERID" in the MDC, the output looks like this:

[USERID][MESG]Initialization successful.

However, in WSAD 5.1 (with all the latest fixpacks)
and its Websphere 5 runtime (version  5.0.2
ptf2M0325.01), the attempt to log a message throws a
NullPointerException. i've traced the NPE to line 118
in the MDC code:

Hashtable ht = (Hashtable)
((ThreadLocalMap)tlm).get();

The call to get() throws the NPE in WSAD 5.1. In WSAD
5.0.x, this line executes and the following line
returns a null (as it should). It also works this way
in WSAD 5.1 using the embedded Websphere 4 runtime. In
searching BugZilla, i found bug # 10528, fixed in July
2002, which modified the code on MDC line 119 - it's
close to my problem! but trouble happens on line 118.

Does anyone have an idea of why this might be
happening? i searched IBM's Websphere support with no
luck, and am trying to examine what's going on in the
classloaders to see how that might be different
between WSAD/Websphere versions. i vaguely suspect a
security problem, but it's unclear why that would
cause an NPE.

thanks in advance,
Joe

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org