我有一个使用primefaces 3.0的JSF2应用程序。
当我在web.xml中包含404错误代码或500错误代码
时 <error-page>
<error-code>404</error-code>
<location>/faces/404.xhtml</location>
</error-page>
我收到以下异常。
java.lang.NullPointerException
at com.sun.faces.context.flash.ELFlash.doLastPhaseActions(ELFlash.java:607)
at com.sun.faces.context.ExternalContextImpl.responseFlushBuffer(ExternalContextImpl.java:857)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:155)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
如何抑制此异常?我在异常处理上遗漏了什么吗?
这是404.xhmtl。我没有在404 xhtml中使用任何引用bean。
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
id="htmlPage">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>
<h:body id="body">
<center>
<div class="headerTop">
<table id="pageHeader">
<tr>
<td align="left">
Header
</td>
</tr>
</table>
</div>
<table id="pageContent" style="background-color: white;min-width: 60%;max-width: 90%" >
<tr>
<td align="center" valign="top" style="min-height: 600px;">
<table width="100%" style="float: left">
<tr>
<td>
404 Error
</td>
</tr>
</table>
</td>
</tr>
</table>
<table style=" width:100%;">
<tr>
<td align="center">
<div>
footer
</div>
</td>
</tr>
</table>
</center>
</h:body>
</html>