1

当我们在 Tomcat 上同时访问 10 多个用户的 JSF 页面时,出现以下异常。我正在使用 JSF 2.0(我的面孔 2.0.5)和丰富的面孔 4。请注意它是随机发生的,并且没有重新创建此错误的步骤。当我们在我的应用程序上运行 10 个并发用户的负载测试时,我开始注意到它。

Please help !!!!. 

The exception is as follows

SEVERE: Servlet.service() for servlet faces threw exception
java.lang.NullPointerException
        at java.lang.Class.isAssignableFrom(Native Method)
        at javax.faces.component.UIComponent$EventListenerWrapper.isListenerForSource(UIComponent.java:1111)
        at org.apache.myfaces.application.ApplicationImpl._traverseListenerList(ApplicationImpl.java:2092)
        at org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:522)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage._publishPostBuildComponentTreeOnRestoreViewEvent(FaceletViewDeclarationLanguage.java:436)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage._publishPostBuildComponentTreeOnRestoreViewEvent(FaceletViewDeclarationLanguage.java:454)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage._publishPostBuildComponentTreeOnRestoreViewEvent(FaceletViewDeclarationLanguage.java:466)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:349)
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:66)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
        at sun.reflect.GeneratedMethodAccessor361.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
        at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
        at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
        at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
        at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
        at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)
        at sun.reflect.GeneratedMethodAccessor360.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
        at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
        at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)

不幸的是,由于时间限制,我们可能无法升级 myfaces。基本上,我在仪表板页面上的链接很少,并且分为两个部分。第一部分显示所有链接,第一部分下方的第二部分显示用户在第一部分中单击的链接的内容。在我们的正常测试期间,一切正常,只有在负载测试期间,每当用户单击仪表板页面中的链接(员工)时,我们才会看到上面我的帖子中提供的异常。如果您需要更多详细信息,请告诉我。感谢您的所有帮助。

4

2 回答 2

0

通过从仪表板页面中删除 JSTL 标记,我的问题得到了解决。它基本上是一个未使用的标签。这份文件帮助我解决了这个问题。

http://myfaces.apache.org/core20/myfaces-impl/xref/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.html

谢谢大家的帮助!!!

于 2013-07-19T18:30:14.667 回答
0

我对相同的堆栈跟踪有类似的问题。我的错是,我使用<c:if />了一个条件,由一个 ajax 请求改变。这会导致在请求期间修改组件树,并且在某些状态下似乎存在问题。我对这个问题的解决方案是使用 an<ui:fragment />并将渲染属性绑定到条件。也许这可以帮助那里的任何人。

于 2016-11-21T08:47:20.003 回答