webtier@glassfish.java.net

Getting NullPointer exception in SessionMap class

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Tue, 27 Jan 2009 21:36:16 -0500

Hey JSFers,

I'm getting an odd exception when running JSF2.0 on Tomcat 6, and a
pretty simple page.


When passing in a null value, in Development stage mode, JSF tries to
get a logger at line 123, but throws the below exception:
What could this mean?

Thanks!

    @Override
    public Object put(String key, Object value) {
        Util.notNull("key", key);
        HttpSession session = getSession(true);
        Object result = session.getAttribute(key);
        if (ProjectStage.Development.equals(stage) && !(value instanceof
Serializable)) {
            LOGGER.log(Level.WARNING,

"jsf.context.extcontext.sessionmap.nonserializable",
                       new Object[]{key, value.getClass().getName()});
        }
        //noinspection NonSerializableObjectBoundToHttpSession
        session.setAttribute(key, value);
        return (result);
    }



Caused by: com.ocpsoft.pretty.PrettyException: PrettyFaces: Exception
occurred while processing <login:#{loginBean.load}>
java.lang.NullPointerException
        at com.ocpsoft.pretty.beans.ActionExecutor.executeActions(Unknown
Source)
        at com.ocpsoft.pretty.event.PrettyPhaseListener.beforePhase(Unknown
Source)
        at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:207)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
        at
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
        at
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:310)
        ... 105 more
Caused by: javax.el.ELException: java.lang.NullPointerException
        at org.apache.el.parser.AstValue.invoke(AstValue.java:176)
        at
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
        at com.ocpsoft.pretty.util.FacesElUtils.invokeMethod(Unknown Source)
        ... 112 more
Caused by: java.lang.NullPointerException
        at com.sun.faces.context.SessionMap.put(SessionMap.java:123)
        at com.sun.faces.context.SessionMap.put(SessionMap.java:57)
        at
com.ocpsoft.storylib.jsf.FacesUtils.setSessionAttribute(FacesUtils.java:97)
        at com.ocpsoft.storylib.pages.login.LoginBean.load(LoginBean.java:58)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
        ... 114 more