Omnifaces ViewScopeManager在访问时提供NullPointerException

时间:2015-02-04 16:43:58

标签: jsf cdi wildfly-8 omnifaces weld2

我刚刚使用maven依赖安装了omnifaces库(2.0),如here所述。 但每当我访问应用程序时,我从名为NullPointerException的CDI @SessionScoped bean获得了ViewScopeManager

[javax.enterprise.resource.webcontainer.jsf.context] (default task-2) java.lang.NullPointerException
at org.omnifaces.cdi.viewscope.ViewScopeManager.preDestroyView(ViewScopeManager.java:132)
at org.omnifaces.cdi.viewscope.ViewScopeManager$Proxy$_$$_WeldClientProxy.preDestroyView(Unknown Source)
at org.omnifaces.application.ViewScopeEventListener.processEvent(ViewScopeEventListener.java:54)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2190)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2163)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:296)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:247)
at org.jboss.as.jsf.injection.weld.ForwardingApplication.publishEvent(ForwardingApplication.java:299)
at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:726)
at javax.faces.component.UIViewRoot$ViewMap.clear(UIViewRoot.java:1849)
at com.sun.faces.context.FacesContextImpl.setViewRoot(FacesContextImpl.java:471)
at com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:152)
at com.sun.faces.application.view.MultiViewHandler.addViewParameters(MultiViewHandler.java:642)
at com.sun.faces.application.view.MultiViewHandler.getFullParameterList(MultiViewHandler.java:617)
at com.sun.faces.application.view.MultiViewHandler.getRedirectURL(MultiViewHandler.java:463)
at javax.faces.application.ViewHandlerWrapper.getRedirectURL(ViewHandlerWrapper.java:250)
at org.jboss.weld.jsf.ConversationAwareViewHandler.getRedirectURL(ConversationAwareViewHandler.java:142)
at javax.faces.application.ViewHandlerWrapper.getRedirectURL(ViewHandlerWrapper.java:250)
at javax.faces.application.ViewHandlerWrapper.getRedirectURL(ViewHandlerWrapper.java:250)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:208)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:183)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:72)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63)
at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745) 

我检查了ViewScopeManager bean源代码,此时activeViewScopes变量似乎为null。它由名为postConstructSession的方法初始化,注释为@PostConstruct注释。我在该方法中设置了断点,似乎它从未被调用过。

我正在使用wildfly 8.2.0.Final web server with weld 2.2.9.Final。 我尝试使用omnifaces作为范围运行时的依赖项并提供(作为Wildfly模块),但仍然存在错误。

Weld的错误吗?当第一次访问bean时,应该调用带有@PostConstruct注释的方法。

请帮我解决这个问题,对不起我的英文:)

编辑: 只有当OmniFaces用作war模块部署时,CDI似乎才能正常工作。这是唯一的方式。 谢谢你的帮助。

0 个答案:

没有答案