Exception about flash in Mojarra JSF
Asked Answered
S

3

12

I upgraded to Mojarra JSF 2.2.1 (from 2.1.22) and since then for each of my requests I'm having an exception in console:

GRAVE: JSF1094: Could not decode flash data from incoming cookie value /?.  
Processing will continue, but the flash is unavailable for this request.
com.sun.faces.lifecycle.InvokeApplicationPhase execute

Request finishes succesfully when I'm not using flash scope on it. However, as I'm using this scope for FacesMessages, if I put a message here, I have a NullPointerException and the navigation flow is interrupted:

GRAVE: El Servlet.service() para servlet Faces Servlet lanzó una excepción
java.lang.NullPointerException
    at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForWriting(ELFlash.java:803)
    at com.sun.faces.context.flash.ELFlash.setKeepMessages(ELFlash.java:323)
    at org.omnifaces.util.Messages.addFlash(Messages.java:460)
    at org.omnifaces.util.Messages.addFlashInfo(Messages.java:488)
    at com.company.view.utils.FacesUtils.addInfoMessage(FacesUtils.java:91)
    at com.company.view.utils.FacesUtils.addInfoMessage(FacesUtils.java:79)
    at com.company.view.beans.navegable.detectables.generic.NavegableDetectableAddGeneric.save(NavegableDetectableAddGeneric.java:92)
    at com.company.view.beans.navegable.detectables.generic.NavegableDetectableAddGeneric.actionSave(NavegableDetectableAddGeneric.java:55)
    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 com.sun.el.parser.AstValue.invoke(AstValue.java:234)
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.tesicnor.system.view.filters.SetHttpHeadersFilter.doFilter(SetHttpHeadersFilter.java:143)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.tesicnor.system.view.filters.SimpleSecurityFilter.doFilter(SimpleSecurityFilter.java:59)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:619)

I also have the same problem with last version of 2.1.x branch (2.1.24). By the way, that's what my addInfoMessage method does:

/**
 * Add information message.
 * 
 * @param msg
 *            the information message
 */
public void addInfoMessage(String msg) {
    addInfoMessage(null, msg);
}

/**
 * Add information message to a specific client.
 * 
 * @param clientId
 *            the client id
 * @param msg
 *            the information message
 */
public void addInfoMessage(String clientId, String msg) {
    Messages.addFlashInfo(clientId, msg);
}

Being Messages class of org.omnifaces.util.Messages type.


EDITED

The problem, which happens only with firefox and when view params are involved, seems to disappear when I clear my browser's cookies. It also seems to persist in the whole 2.2.x and 2.1.x branches (at least till 2.2.4-2.1.26), displaying an slightly different trace:

com.sun.faces.context.flash.ELFlash getCurrentFlashManager GRAVE: JSF1094: Could not decode flash data from incoming cookie value Invalid characters in decrypted value. Processing will continue, but the flash is unavailable for this request.

According to @BalusC here (aug-2013):

We also encountered this in Mojarra 2.1.24. We concluded that ELFlash class is - honestly said - one terrible mess which seems to be originally written by an intern without a solid background knowledge about HTTP matters.

Soviet answered 16/7, 2013 at 5:52 Comment(1)
I have the same problem. This appears to happen when there is an active flash and you restart the server. If you clear your browser cookies(for your url) then this goes away.Sampan
H
3

I can recreate the problem on any browser. I just opened https://java.net/jira/browse/JAVASERVERFACES-2973 to address this.

Harm answered 31/7, 2013 at 13:5 Comment(2)
It is definitely a bug.Soviet
It seems they fixed it for 2.1.25. However, I'm still with problems because the inserted flash values are surviving more than two requests. I use POST-REDIRECT-GET pattern.Soviet
E
3

I don't have enough rep to comment, so I write an answer....

It happens on any browser as Stan Silvert says. 2.1.25 is fixing it, but https://java.net/jira/browse/JAVASERVERFACES-2862 is fixed on 2.1.27 for 2.1.x branch : https://java.net/jira/browse/JAVASERVERFACES-3089

2.1.27 has a due date of January 2nd, 2014.

Ehrenburg answered 6/12, 2013 at 10:19 Comment(0)
T
1

I think Mojarra 2.2.2 / 2.1.25 will fix this, considering: https://java.net/jira/browse/JAVASERVERFACES-2955

Therapist answered 30/7, 2013 at 15:5 Comment(1)
That bug is about IE, I'm using FirefoxSoviet

© 2022 - 2024 — McMap. All rights reserved.