Eager ApplicationScoped managed beans constructed multiple times

混江龙づ霸主 提交于 2019-11-30 10:01:48
ShirouWrath

I have hopefully resolved this problem on Tomcat 8 + Mojarra 2.2.0. In my case I just removed listener declaration from web.xml

<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

Constructor seems to be called once afterwards.

About listener entry, there is a part of BalusC answer of this question.

In any case, the explicit registration of Mojarra's ConfigureListener in web.xml is actually only necessary to workaround old buggy servers such as GlassFish v3 and Jetty who failed to find the listener in Mojarra's TLD file. When deployed to a decent server, the whole entry is unnecessary.

I have same problems with Mojarra 2.0.x. I guess that problem is connected with multithreaded JSF initilization. Try disabling it by com.sun.faces.enableMultiThreadedStartup parameter.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!