Eager ApplicationScoped managed beans constructed multiple times

前端 未结 2 1052
醉梦人生
醉梦人生 2021-01-01 02:08

I have a bunch of eager ApplicationScoped managed beans. Some of them are injected into others by the ManagedProperty annotation, forming

相关标签:
2条回答
  • 2021-01-01 02:22

    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.

    0 讨论(0)
  • 2021-01-01 02:29

    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.

    0 讨论(0)
提交回复
热议问题