我在 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
不可访问。这是如何引起的,我该如何解决?