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

断了今生、忘了曾经 提交于 2019-12-02 07:20:36

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.

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