我的应用程序使用JSF 2.1和PrimeFaces。最近,由于一些卡住的线程,观察到非常高的CPU利用率。所有卡住线程的卡住线程转储指向javax.faces.component.UIComponent.popComponentFromEL
,如下所示:
javax.faces.component.UIComponent.popComponentFromEL(UIComponent.java:1934)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1633)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
org.primefaces.component.api.UIData.visitRows(UIData.java:741)
org.primefaces.component.api.UIData.visitTree(UIData.java:656)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
org.primefaces.component.accordionpanel.AccordionPanel.visitTree(AccordionPanel.java:371)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIForm.visitTree(UIForm.java:371)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
com.sun.faces.application.view.StateManagementStrategyImpl.findComponent(StateManagementStrategyImpl.java:440)
com.sun.faces.application.view.StateManagementStrategyImpl.restoreDynamicRemove(StateManagementStrategyImpl.java:412)
com.sun.faces.application.view.StateManagementStrategyImpl.restoreDynamicActions(StateManagementStrategyImpl.java:317)
com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:281)
com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:188)
com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:453)
com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142)
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:77)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
com.ultimatix.bgc.framework.GBGCSessionControllerFilter.doFilter(GBGCSessionControllerFilter.java:90)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
com.ultimatix.framework.jsf.util.ForcedLoginFilter.doFilter(ForcedLoginFilter.java:505)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
com.ultimatix.framework.jsf.util.IndexFilter.doFilter(IndexFilter.java:338)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
com.ultimatix.framework.jsf.util.SecurityInterceptor.doFilter(SecurityInterceptor.java:40)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
这是如何引起的?如何解决?
答案 0 :(得分:5)
根据Mojarra issue 2722,当您将组件实例错误地绑定到托管bean的bean属性时,会发生这种情况,该bean属性不是请求作用域,而是在更广泛的范围内。
<x:someComponent binding="#{viewOrSessionOrApplicationScopedBean.component}" />
相应地修复代码,以免发生这种情况。组件本质上是请求范围的,并且绝对不能跨多个请求共享。另见JSF 2.0 specitication第3.1.5章:
3.1.5组件绑定
...
组件绑定通常与通过Managed动态实例化的JavaBeans结合使用 Bean Creation工具(参见第5.8.1节“VariableResolver和默认VariableResolver”)。 强烈 建议应用程序开发人员放置由组件绑定表达式指向的托管bean “request”scope。这是因为将它放在会话或应用程序范围内需要线程安全,因为 UIComponent实例依赖于在单个线程内部运行。对...也有潜在的负面影响 将组件绑定放在“会话”范围内时的内存管理。