java.lang.NullPointerException

Spring JIRA | !!Use pwebb rather than philw | 6 years ago
  1. 0

    When rendering a JSF view that is not part of flow request a NullPointerException is thrown: {noformat} java.lang.NullPointerException at org.springframework.faces.webflow.FlowViewStateManager.saveView(FlowViewStateManager.java:181) at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:221) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:406) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127) at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269) at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135) at org.springframework.springfaces.FacesView.renderMergedOutputModel(FacesView.java:39) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 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:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) {noformat} The StateManager should probably just delegate if JsfUtils.isFlowRequest() returns false: {code} if (context.getViewRoot().isTransient()) { return null; } if(!JsfUtils.isFlowRequest()) { return delegate.saveView(context); } FlowSerializedView view = null; if (JsfRuntimeInformation.isPartialStateSavingSupported()) { Object[] state = (Object[]) delegate.saveView(context); view = new FlowSerializedView(context.getViewRoot().getViewId(), state[0], state[1]); } else { view = new FlowSerializedView(context.getViewRoot().getViewId(), getTreeStructureToSave(context), getComponentStateToSave(context)); } ... {code}

    Spring JIRA | 6 years ago | !!Use pwebb rather than philw
    java.lang.NullPointerException
  2. 0

    When rendering a JSF view that is not part of flow request a NullPointerException is thrown: {noformat} java.lang.NullPointerException at org.springframework.faces.webflow.FlowViewStateManager.saveView(FlowViewStateManager.java:181) at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:221) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:406) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127) at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269) at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135) at org.springframework.springfaces.FacesView.renderMergedOutputModel(FacesView.java:39) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 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:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) {noformat} The StateManager should probably just delegate if JsfUtils.isFlowRequest() returns false: {code} if (context.getViewRoot().isTransient()) { return null; } if(!JsfUtils.isFlowRequest()) { return delegate.saveView(context); } FlowSerializedView view = null; if (JsfRuntimeInformation.isPartialStateSavingSupported()) { Object[] state = (Object[]) delegate.saveView(context); view = new FlowSerializedView(context.getViewRoot().getViewId(), state[0], state[1]); } else { view = new FlowSerializedView(context.getViewRoot().getViewId(), getTreeStructureToSave(context), getComponentStateToSave(context)); } ... {code}

    Spring JIRA | 6 years ago | !!Use pwebb rather than philw
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.faces.webflow.FlowViewStateManager.saveView()
    2. org.springframework.faces
      FlowViewStateManager.saveView
      1. org.springframework.faces.webflow.FlowViewStateManager.saveView(FlowViewStateManager.java:181)
      1 frame
    3. JSF
      MultiViewHandler.renderView
      1. com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:221)
      2. com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:406)
      3. com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
      3 frames
    4. org.springframework.faces
      FlowViewHandler.renderView
      1. org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99)
      1 frame
    5. JavaEE 7
      ViewHandlerWrapper.renderView
      1. javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269)
      1 frame
    6. org.springframework.faces
      FlowViewHandler.renderView
      1. org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99)
      1 frame
    7. JSF
      LifecycleImpl.render
      1. com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
      2. com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
      3. com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
      3 frames
    8. org.springframework.springfaces
      FacesView.renderMergedOutputModel
      1. org.springframework.springfaces.FacesView.renderMergedOutputModel(FacesView.java:39)
      1 frame
    9. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
      2. org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
      3. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
      4. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      5. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
      6. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
      6 frames
    10. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      2 frames
    11. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      7. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      8. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      8 frames
    12. Grizzly HTTP
      JIoEndpoint$Worker.run
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      3. org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      3 frames
    13. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:662)
      1 frame