在 WildFly 8-1 上,我有primefaces-5.1.jar
并且primefaces-extensions-2.1.0.jar
在我的 webappsWEB-INF/lib
目录中。
我已经配置WEB-INF/faces-config.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<application>
<el-resolver>org.primefaces.application.exceptionhandler.PrimeExceptionHandlerELResolver</el-resolver>
</application>
<factory>
<exception-handler-factory>org.primefaces.application.exceptionhandler.PrimeExceptionHandlerFactory</exception-handler-factory>
</factory>
</faces-config>
我有以下JSF。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<h:head></h:head>
<h:body>
<h:form id="form">
<pe:ajaxErrorHandler body="ERROR"/>
<p:commandButton actionListener="#{dossierResumen.excepcion}" value="Excepción"/>
</h:form>
</h:body>
</html>
DossierResumen#excepcion()
在哪里
public void excepcion() {
throw new NullPointerException("EXCEPCION! EXCEPCION!");
}
当我单击按钮时,根本没有弹出窗口;页面被重定向到 URL 中定义的错误 500 web.xml
。在日志中,我得到以下堆栈跟踪墙:
我究竟做错了什么?
15:44:14,206 错误 [stderr](默认任务 42)java.lang.NullPointerException:异常!例外!15:44:14,206 错误 [stderr](默认任务 42)在 es.imasmallorca.selene.webone.jsf.controller.dossier.DossierResumen.excepcion(DossierResumen.java:55)15:44:14,206 错误 [stderr](默认任务 42)在 es.imasmallorca.selene.webone.jsf.controller.dossier.DossierResumen$Proxy$_$$PrimeExceptionHandler](默认任务 42)例外!异常!:java.lang.NullPointerException:异常!例外!在 es.imasmallorca.selene.webone.jsf.controller.dossier.DossierResumen.excepcion(DossierResumen.java:55) [classes:] 在 es.imasmallorca.selene.webone.jsf.controller.dossier.DossierResumen$Proxy$$$_WeldClientProxy.excepcion(Unknown Source) [classes:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_55] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [ rt.jar:1.7.0_55] 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_55] 在 java.lang.reflect.Method.invoke(Method.java:606) [ rt.jar:1.7.0_55] 在 com.sun.el.parser.AstValue.invoke(AstValue.java:275) [javax.el-3.0.0.jar:] 在 com.sun.el.MethodExpressionImpl.invoke( MethodExpressionImpl.java:304) [javax.el-3.0.0.jar:] at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40) [weld-core-impl-2.1.2. Final.jar:2014-01-09 09:23] 在 org.jboss.weld.el.WeldMethodExpression。调用(WeldMethodExpression.java:50)[weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23] 在 org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java :40) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23] at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) [weld-core -impl-2.1.2.Final.jar:2014-01-09 09:23] 在 javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:149) [jboss-jsf-api_2.2_spec-2.2.6。 jar:2.2.6] 在 javax.faces.event.ActionEvent.processListener(ActionEvent.java:88) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 在 javax.faces.component.UIComponentBase .broadcast(UIComponentBase.java:813) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 在 javax.faces.component.UICommand.broadcast(UICommand.java:300) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 在 javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) [jboss-jsf-api_2.2_spec-2.2.6 .jar:2.2.6] 在 javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 在 com.sun.faces。 lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.2.6-jbossorg-4.jar:] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf- impl-2.2.6-jbossorg-4.jar:] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) [jsf-impl-2.2.6-jbossorg-4.jar:] at javax .faces.webapp.FacesServlet.service(FacesServlet.java:646) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6] 在 io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java :85) [undertow-servlet-1.0.15.Final。jar:1.0.15.Final] 在 io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 在 io .undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 在 org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest (SecurityContextAssociationHandler.java:78) 在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow。 servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.servlet.handlers。security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar :1.0.15.Final] 在 io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 在 io。 undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow。servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler. java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15 .Final.jar:1.0.15.Final] 在 org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61) 在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java :25) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15。最终的.jar:1.0.15。最终] 在 io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.servlet.handlers.ServletInitialHandler .dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow -servlet-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar: 1.0.15.Final] 在 io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 在 io.undertow.server.HttpServerExchange $1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final] 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55] 在 java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55] 在 java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_55]
更新:
应 Guaido79 的要求,我的web.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>seleneWar</display-name>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<error-page>
<error-code>500</error-code>
<location>/error/500.xhtml</location>
</error-page>
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>primefaces.CLIENT_SIDE_VALIDATION</param-name>
<param-value>true</param-value>
</context-param>
<resource-ref>
<res-ref-name>jsf/ProjectStage</res-ref-name>
<res-type>java.lang.String</res-type>
</resource-ref>
</web-app>