"Key for session.getAttribute() is null" Error in WLS 11g Web Application (Doc ID 1402628.1)

Last updated on MARCH 06, 2012

Applies to:

Oracle Weblogic Server - Version: 10.3.5 and later   [Release: and later ]
Information in this document applies to any platform.

Symptoms

After deploying an application as an EAR file to Oracle WebLogic Server 11g, most of the modules work, but on one module, the following error is generated:

java.lang.IllegalArgumentException: Key for session.getAttribute() is null
  at weblogic.servlet.internal.session.SessionData.check(SessionData.java:475)
  at weblogic.servlet.internal.session.SessionData.getAttribute(SessionData.java:386)
....

This code after being tested in Oracle Weblogic 10.3.0 (10g) works fine.


Changes

In WLS 10.3.1 and higher, the SessionData class uses a ConcurrentHashMap rather than the HashMap which was used previously. This is because ConcurrentHashMap is more thread-safe. HashMap allows null keys, and that's why it worked with null keys in WLS 10.3.0 and earlier. However, ConcurrentHashMap requires that null keys not be used.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms