JSF mojarra 2.1.7 restoreView isPostBack: java.lang.NullPoin



我在JBoss AS 7.1.1上使用PrimeFaces 3.4.2和Mojarra 2.1.7。

恢复视图时出现以下异常。

21:58:33,203 ERROR  (http--127.0.0.1-8080-7) java.lang.NullPointerException
21:58:36,687 ERROR [stderr] (http--127.0.0.1-8080-7) java.lang.IllegalArgumentException: null source
21:58:36,687 ERROR [stderr] (http--127.0.0.1-8080-7)    at java.util.EventObject.<init>(EventObject.java:38)
21:58:36,687 ERROR [stderr] (http--127.0.0.1-8080-7)    at javax.faces.event.SystemEvent.<init>(SystemEvent.java:71)
21:58:36,703 ERROR [stderr] (http--127.0.0.1-8080-7)    at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:73)
21:58:36,703 ERROR [stderr] (http--127.0.0.1-8080-7)    at javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:73)
21:58:36,703 ERROR [stderr] (http--127.0.0.1-8080-7)    at com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:271)
21:58:36,703 ERROR [stderr] (http--127.0.0.1-8080-7)    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:257)
21:58:36,703 ERROR [stderr] (http--127.0.0.1-8080-7)    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
21:58:36,718 ERROR [stderr] (http--127.0.0.1-8080-7)    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
21:58:36,718 ERROR [stderr] (http--127.0.0.1-8080-7)    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
21:58:36,718 ERROR [stderr] (http--127.0.0.1-8080-7)    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
@Override
public boolean isPostback() {
    assertNotReleased();
    Boolean postback = (Boolean) this.getAttributes().get(POST_BACK_MARKER);
    if (postback == null) {
        RenderKit rk = this.getRenderKit();
        if (rk != null) {
            postback = rk.getResponseStateManager().isPostback(this);
        } else {
            // ViewRoot hasn't been set yet, so calculate the RK
            ViewHandler vh = this.getApplication().getViewHandler();
            String rkId = vh.calculateRenderKitId(this);
            postback = RenderKitUtils.getResponseStateManager(this, rkId)
                  .isPostback(this);
        }
        this.getAttributes().put(POST_BACK_MARKER, postback);
    }
    return postback;
}
public String calculateRenderKitId(FacesContext context) {
    Util.notNull("context", context);
    Map<String,String> requestParamMap = context.getExternalContext()
        .getRequestParameterMap();
    String result = requestParamMap.get(         // <--------- exception here !!!!!!
        ResponseStateManager.RENDER_KIT_ID_PARAM);
    if (result == null) {
        if (null ==
            (result = context.getApplication().getDefaultRenderKitId())) {
            result = RenderKitFactory.HTML_BASIC_RENDER_KIT;
        }
    }
    return result;
}

调用 isPostback() 时发生异常,调用 calculateRenderKitId()

String result = requestParamMap.get( // <--------- exception here !!!!!!
    ResponseStateManager.RENDER_KIT_ID_PARAM);

requestParamMap无法访问。这是如何造成的,我该如何解决?

很可能遇到请求参数限制。不幸的是,由于 JSF 中的异常处理,真正的异常是隐藏的。默认情况下,一个请求只能有 512 个参数,因此如果您提交大型列表,请求将触发未捕获的 illegalArgumentException,该异常将被忽略,并且您的请求将在非意义空指针异常时失败。

尝试将其添加到您的 jboss 独立版中.xml

 <system-properties>
     <property name="org.apache.tomcat.util.http.Parameters.MAX_COUNT" value="5000"/>
</system-properties>

相关内容

  • 没有找到相关文章

最新更新