1

I have a webapplication based on JSF(2.1.17) myfaces /PrimeFaces + Omnifaces on WAS 8.0.0.9

Most of the time everything works ok, but occasionally I get the following exception:

java.lang.NullPointerException
        at org.apache.myfaces.shared.context.flash.FlashImpl.isKeepMessages(FlashImpl.java:388)
        at org.apache.myfaces.shared.context.flash.FlashImpl._saveMessages(FlashImpl.java:668)
        at org.apache.myfaces.shared.context.flash.FlashImpl.doPostPhaseActions(FlashImpl.java:269)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:254)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:199)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
        at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
        at org.omnifaces.filter.FacesExceptionFilter.doFilter(FacesExceptionFilter.java:56)
        at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:77)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)

// ... more filters ...

When looking at FlashImpl line388 if find:

@Override
public boolean isKeepMessages()
{
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext externalContext = facesContext.getExternalContext(); //<-- line 388
    Map<String, Object> requestMap = externalContext.getRequestMap();
    Boolean keepMessages = (Boolean) requestMap.get(FLASH_KEEP_MESSAGES);

    return (keepMessages == null ? Boolean.FALSE : keepMessages);
}

So it looks like there is no FacesContext. Although (again from looking at the code) it should get created in FacesServlet.service further up the call stack.

One of the filters we have registered logs time used in the different phases of the JSF lifecycle, and it complains that the phase RENDER_RESPONSE is started, although it is already running.

Logging is also suggesting that in the current request the requested page could not be found and therefor the apropriate error page is requested.

All this might happen during an Ajax request but I am not sure.

Any ideas what might be causing this problem?

I found this bugreport but couldn't find a reference to getRequestDispatcher so it doesn't seem to apply.

I also found this question: Null pointer exception in FlashImpl.java in IBM JSF which actually might be a duplicate but since I have more (possibly relevant) information which might or might not apply to the other question I thought it better to create a new one.

Community
  • 1
  • 1
Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
  • 1
    Just a vague idea: We faced similar issues that were related to session time-outs. We have a component that polls for messages by the admins for the users. These poll requests (Ajax) ran into the session time-out. – cheffe Jun 15 '15 at 10:56
  • Just to clarify my idea, we have spring security in place for the application. After the session timeout, the user has lost his roles and therefore the right to access the content. They also got a 404, since spring security hid the resources. – cheffe Jun 17 '15 at 06:46

0 Answers0