0

JSF(jboss - 2.2.6),AS Wildfly 8.1.0,Deltaspike 1.0.3

会话过期后,按下按钮(ajax 调用)。问题是抛出了 NullPointerExceptiion 而不是 ViewExpiredException。

有一个ExceptionHandlerWraper。

public class CoreExceptionHandlerWrapper extends ExceptionHandlerWrapper {

private final BeanManager beanManager;

private final ExceptionHandler wrapped;

public CoreExceptionHandlerWrapper(final ExceptionHandler wrapped) {
    this.wrapped = wrapped;
    this.beanManager = BeanManagerProvider.getInstance().getBeanManager();
}

@Override
public ExceptionHandler getWrapped() {
    return this.wrapped;
}

@Override
public void handle() throws FacesException {
    FacesContext context = FacesContext.getCurrentInstance();
    Iterator<ExceptionQueuedEvent> it = getUnhandledExceptionQueuedEvents().iterator();
    while (it.hasNext()) {
        try {
            ExceptionQueuedEvent evt = it.next();
            ExceptionToCatchEvent etce = null;

            if (context == null || !context.getPartialViewContext().isAjaxRequest()) {
                etce = new ExceptionToCatchEvent(evt.getContext().getException(), WebRequestLiteral.INSTANCE);
            } else {
                etce = new ExceptionToCatchEvent(evt.getContext().getException(), FacesRequestLiteral.INSTANCE);
            }
            beanManager.fireEvent(etce);
        } finally {
            it.remove();
        }

       }
    getWrapped().handle();
    }  
}

FacesException 由以下方式处理:

void showFacesMessage(@Handles @FacesRequest ExceptionEvent<Throwable> evt, FacesContext fc) {
    Throwable exception = evt.getException();

    persistException(evt.getException());
    if(exception instanceof ViewExpiredException) {
        NavigationHandler nav = fc.getApplication().getNavigationHandler();
        try {
            nav.handleNavigation(fc, null, "/login.xhtml?faces-redirect=true");//?faces-redirect=true&amp;exceptionMessage=" + exceptionMessage
        } catch(Exception e) {System.out.println(e.toString());}
        fc.renderResponse();
    }

这是堆栈:

18:10:50,412 ERROR [io.undertow.request] (default task-123) UT005023: Exception handling request to /context/page.jsf: javax.servlet.ServletException: javax.el.ELException: /page.xhtml @89,37 inputBinding="#{bean.uiInput}": org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke public void package.Bean.postConstruct() on package.Bean@5f8f6443
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: javax.faces.FacesException: javax.el.ELException: /page.xhtml @89,37 inputBinding="#{bean.uiInput}": org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke public void package.Bean.postConstruct() on package.Bean@5f8f6443
at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:2409) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap.get(CompositeComponentAttributesELResolver.java:393) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.el.MapELResolver.getValue(MapELResolver.java:199) [jboss-el-api_3.0_spec-1.0.3.Final.jar:1.0.3.Final]
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.el.parser.AstValue.getValue(AstValue.java:140) [javax.el-3.0.0.jar:]
at com.sun.el.parser.AstValue.getValue(AstValue.java:204) [javax.el-3.0.0.jar:]
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226) [javax.el-3.0.0.jar:]
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at com.sun.faces.facelets.el.ContextualCompositeValueExpression.getValue(ContextualCompositeValueExpression.java:158) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1964) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1151) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:625) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.jboss.as.jsf.injection.weld.ForwardingApplication.createComponent(ForwardingApplication.java:123) [wildfly-jsf-injection-8.1.0.Final.jar:8.1.0.Final]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.createComponent(ComponentTagHandlerDelegateImpl.java:578) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:176) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at com.sun.faces.facelets.tag.composite.ImplementationHandler.apply(ImplementationHandler.java:81) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:312) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:371) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:326) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyCompositeComponent(CompositeComponentTagHandler.java:385) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyNextHandler(CompositeComponentTagHandler.java:186) [jsf-impl-2.2.6-jbossorg-4.jar:]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:106) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:206) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:395) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:366) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:111) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.richfaces.ui.behavior.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53) [richfaces-5.0.0.Alpha3.jar:5.0.0.Alpha3]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:225) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:312) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:371) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:350) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:174) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:161) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:995) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:584) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:150) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:353) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at org.omnifaces.viewhandler.RestorableViewHandler.restoreView(RestorableViewHandler.java:66) [omnifaces-1.8.1.jar:1.8.1-20140603]
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:353) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:353) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:353) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:197) [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.RestoreViewPhase.doPhase(RestoreViewPhase.java:121) [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]
... 26 more
Caused by: javax.el.ELException: /page.xhtml @89,37 inputBinding="#{bean.uiInput}": org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke public void package.Bean.postConstruct() on package.Bean@5f8f6443
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114) [jsf-impl-2.2.6-jbossorg-4.jar:]
at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:2407) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
... 128 more
Caused by: javax.el.ELException: org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke public void package.Bean.postConstruct() on package.Bean@5f8f6443
at javax.el.BeanELResolver.getValue(BeanELResolver.java:368) [jboss-el-api_3.0_spec-1.0.3.Final.jar:1.0.3.Final]
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.el.parser.AstValue.getValue(AstValue.java:140) [javax.el-3.0.0.jar:]
at com.sun.el.parser.AstValue.getValue(AstValue.java:204) [javax.el-3.0.0.jar:]
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226) [javax.el-3.0.0.jar:]
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.2.6-jbossorg-4.jar:]
... 129 more
Caused by: org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke public void package.Bean.postConstruct() on package.Bean@5f8f6443
at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:91) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:72) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:95) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at org.jboss.weld.injection.producer.BeanInjectionTarget.postConstruct(BeanInjectionTarget.java:63) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:153) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at org.jboss.weld.util.bean.IsolatedForwardingBean.create(IsolatedForwardingBean.java:44) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at com.sun.faces.application.view.ViewScopeContextManager.createBean(ViewScopeContextManager.java:136) [jsf-impl-2.2.6-jbossorg-4.jar:]
at com.sun.faces.application.view.ViewScopeContext.get(ViewScopeContext.java:137) [jsf-impl-2.2.6-jbossorg-4.jar:]
at org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:76) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:98) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:78) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
at com.unifik.core.candidate.bean.CurriculumBean$Proxy$_$$_WeldClientProxy.getCandidatePersonalIdentifierUi(Unknown Source) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
at javax.el.BeanELResolver.getValue(BeanELResolver.java:363) [jboss-el-api_3.0_spec-1.0.3.Final.jar:1.0.3.Final]
... 137 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:89) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
... 153 more
Caused by: java.lang.NullPointerException
at package.Bean.postConstruct(Bean.java:280) [classes:]
... 158 more
4

1 回答 1

0

经过调试,我能够找到 NullPointerException 的主要问题。视图中有组件使用绑定属性引用 bean(javax.faces.view.ViewScoped) 中的 javax.faces.component.UIInput 对象。当会话到期并进行 ajax 调用并创建(两次)bean 的新实例时。我不为什么 UIInput 强制创建 bean,但这是另一个话题。在用@PostConstruct 注释的方法中,有一段代码会抛出 NullPointerException。如果在引发预期的 ViewExpiredException 之后正确处理了此异常。

于 2014-10-01T14:08:36.460 回答