java.lang.Class.isAssignableFrom中的空指针异常

时间:2013-07-11 20:54:38

标签: jsf-2 richfaces myfaces

当我们在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。基本上我在仪表板页面上有很少的链接,它分为两部分。第一部分显示所有链接,第二部分位于第一部分下方,显示第一部分中链接用户点击的内容。在我们的正常测试期间,一切正常,只有在负载测试期间,只要用户点击仪表板页面中的链接(人员),我们就会看到上面帖子中提供的异常。如果您需要更多详细信息,请与我们联系。谢谢你的帮助。

2 个答案:

答案 0 :(得分:0)

我的问题通过从信息中心页面删除JSTL标记得到解决。它基本上是一个未使用的标签。本文档帮助我解决了这个问题。

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

感谢大家的帮助!!!

答案 1 :(得分:0)

我在同一个堆栈跟踪中遇到了类似的问题。 我的错是,我使用了<c:if />条件,通过ajax请求进行更改。这导致在请求期间对组件树进行修改,并且在某些状态下似乎存在问题。 我对此问题的解决方案是使用<ui:fragment />代替并将rendered-attribute绑定到条件。也许这对任何人都有帮助。