You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2014/09/01 21:23:21 UTC

[jira] [Commented] (MYFACES-3921) NullPointerException at SerializedViewCollection

    [ https://issues.apache.org/jira/browse/MYFACES-3921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14117650#comment-14117650 ] 

Leonardo Uribe commented on MYFACES-3921:
-----------------------------------------

I have checked the code and the problem seems to be caused because with JSF 2.0 PSS, the state is so small than sometimes it is null, or in other words, the page does not contains any state and only the key of the view is saved. This is nice, because in this case the key works as a token to protect the view, which gives a great performance.

This param that you are using:

org.apache.myfaces.CACHE_OLD_VIEWS_IN_SESSION_MODE = hard-soft

was deprecated in JSF 2.2. The idea of that param was do not discard the view state unless the GC or the session strategy (in a cluster when the state is serialized for exampe) requires to do so. Instead, the state is kept in memory as a soft reference. It is a good idea and it works, but with JSF 2.0 Partial State Saving, the state became so small, that you could have a view with 70 or 80 views and the session size does not increase significantly (compare to JSF 1.2 state saving it was a reduction of 90% or even more in the view size), so it was decided to remove it in JSF 2.2 because it no longer has the same effect as before. 

To fix the problem in your application, just remove the param, but anyway I'll apply a patch for 2.0/2.1 branches. The fix is just avoid the null and put EMPTY_STATES instead.

> NullPointerException at SerializedViewCollection
> ------------------------------------------------
>
>                 Key: MYFACES-3921
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3921
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.1.15
>         Environment: Windows, Myfaces 2.1.5, Weblogic 12c.
>            Reporter: AVIJIT CHAKRABORTY
>            Priority: Critical
>
> I have recently upgraded my WebApp to MyFaces 2.1.15 and after that I am experiencing the below error infrequently,
> java.lang.NullPointerException: null values not allowed
> 	at org.apache.commons.collections.map.AbstractReferenceMap.put(AbstractReferenceMap.java:251)
> 	at org.apache.myfaces.application.viewstate.SerializedViewCollection.add(SerializedViewCollection.java:162)
> 	at org.apache.myfaces.application.viewstate.ServerSideStateCacheImpl.saveSerializedViewInServletSession(ServerSideStateCacheImpl.java:300)
> 	at org.apache.myfaces.application.viewstate.ServerSideStateCacheImpl.saveSerializedView(ServerSideStateCacheImpl.java:578)
> 	at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.saveState(HtmlResponseStateManager.java:146)
> 	at org.apache.myfaces.application.StateManagerImpl.saveView(StateManagerImpl.java:198)
> 	at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:2052)
> 	at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:305)
> 	at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116)
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:241)
> 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:199)
> 	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
> 	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
> 	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
> 	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
> 	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
> 	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
> I have set the following in web.xml file,
> org.apache.myfaces.CACHE_OLD_VIEWS_IN_SESSION_MODE = hard-soft
> org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION = 30,
> org.apache.myfaces.SERIALIZE_STATE_IN_SESSION= false,
> javax.faces.STATE_SAVING_METHOD = false
> I have checked similar issue in earlier version too, 
> https://issues.apache.org/jira/browse/MYFACES-1296
> but this seems to be little different from the exception stack.
> In my WebApp, this issue comes infrequently. i.e. it comes randomly in random pages.
> Please look into it since it seems to be an issue with the version 2.1.15



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)