@Eager is unavailable. The EagerBeansRepository could not be obtained from CDI bean manager

后端 未结 1 1677
醉酒成梦
醉酒成梦 2020-12-21 22:44

This is my first usage of omnifaces. My app works well without it but when I tried it I get the following exception.

java.lang.NullPointerException
    at or         


        
相关标签:
1条回答
  • 2020-12-21 23:32

    When I remove omnifaces-2.1.jar from glassfish domain1/lib directory, everything works fine.

    Web libraries doesn't belong there. Web libraries belong in /WEB-INF/lib of the WAR. When misplaced outside /WEB-INF/lib, then the webapp won't be able to find JSF/CDI annotated classes in the web library and throw exceptions related to this.

    Put back OmniFaces JAR file from domain1/lib into /WEB-INF/lib. Then JSF will be able to find @FacesComponent annotated classes bundled in OmniFaces and CDI will be able to find @XxxScoped classes bundled in OmniFaces, such as the EagerBeansRepository class.

    See also "Installation" section of OmniFaces homepage:

    Installation

    It is a matter of dropping the OmniFaces 2.1 JAR file in /WEB-INF/lib.

    ...

    OmniFaces is designed as a WAR library (web fragment library) and therefore can't be placed elsewhere in the webapp's runtime classpath outside WAR's own /WEB-INF/lib, such as EAR's /lib or even server's or JRE's own /lib. When OmniFaces JAR file is misplaced this way, then the webapp will be unable to find OmniFaces-bundled JSF/CDI annotated classes and throw exceptions related to this during deploy or runtime. To solve it, put back OmniFaces in WAR's /WEB-INF/lib.

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