OmniFaces CDI

CDI

So, you got the following error in server log when using OmniFaces 2.x?

org.omnifaces.ApplicationInitializer checkCDI11Available
SEVERE: 
████████████████████████████████████████████████████████████████████████████████
▌                         ▐█     ▐                                             ▐
▌    ▄                  ▄█▓█▌    ▐ OmniFaces failed to initialize!             ▐
▌   ▐██▄               ▄▓░░▓▓    ▐                                             ▐
▌   ▐█░██▓            ▓▓░░░▓▌    ▐ This OmniFaces version requires CDI,        ▐
▌   ▐█▌░▓██          █▓░░░░▓     ▐ but none was found on this environment.     ▐
▌    ▓█▌░░▓█▄███████▄███▓░▓█     ▐                                             ▐
▌    ▓██▌░▓██░░░░░░░░░░▓█░▓▌     ▐ OmniFaces 3.x requires a minimum of JSF 2.3.▐
▌     ▓█████░░░░░░░░░░░░▓██      ▐ Since this JSF version, the JSF managed bean▐
▌     ▓██▓░░░░░░░░░░░░░░░▓█      ▐ facility @ManagedBean is DEPRECATED in      ▐
▌     ▐█▓░░░░░░█▓░░▓█░░░░▓█▌     ▐ in favour of CDI and CDI has become a       ▐
▌     ▓█▌░▓█▓▓██▓░█▓▓▓▓▓░▓█▌     ▐ REQUIRED dependency for JSF 2.3.            ▐
▌     ▓▓░▓██████▓░▓███▓▓▌░█▓     ▐                                             ▐
▌    ▐▓▓░█▄▐▓▌█▓░░▓█▐▓▌▄▓░██     ▐                                             ▐
▌    ▓█▓░▓█▄▄▄█▓░░▓█▄▄▄█▓░██▌    ▐                                             ▐
▌    ▓█▌░▓█████▓░░░▓███▓▀░▓█▓    ▐                                             ▐
▌   ▐▓█░░░▀▓██▀░░░░░ ▀▓▀░░▓█▓    ▐                                             ▐
▌   ▓██░░░░░░░░▀▄▄▄▄▀░░░░░░▓▓    ▐                                             ▐
▌   ▓█▌░░░░░░░░░░▐▌░░░░░░░░▓▓▌   ▐                                             ▐
▌   ▓█░░░░░░░░░▄▀▀▀▀▄░░░░░░░█▓   ▐                                             ▐
▌  ▐█▌░░░░░░░░▀░░░░░░▀░░░░░░█▓▌  ▐                                             ▐
▌  ▓█░░░░░░░░░░░░░░░░░░░░░░░██▓  ▐                                             ▐
▌  ▓█░░░░░░░░░░░░░░░░░░░░░░░▓█▓  ▐ You have 3 options:                         ▐
██████████████████████████████████ 1. Downgrade to OmniFaces 1.x.              ▐
█░▀░░░░▀█▀░░░░░░▀█░░░░░░▀█▀░░░░░▀█ 2. Install CDI in this environment.         ▐
█░░▐█▌░░█░░░██░░░█░░██░░░█░░░██░░█ 3. Switch to a CDI capable environment.     ▐
█░░▐█▌░░█░░░██░░░█░░██░░░█░░░██░░█                                             ▐
█░░▐█▌░░█░░░██░░░█░░░░░░▄█░░▄▄▄▄▄█ For additional instructions, check          ▐
█░░▐█▌░░█░░░██░░░█░░░░████░░░░░░░█ http://omnifaces.org/cdi                    ▐
█░░░█░░░█▄░░░░░░▄█░░░░████▄░░░░░▄█                                             ▐
████████████████████████████████████████████████████████████████████████████████

Okay, here are the additional instructions:

  1. Downgrade to OmniFaces 1.x.
    This version doesn't require CDI. So you should be able to run it on CDI-less environments. You can find download links in the homepage.
  2. Install CDI 1.1+ in this environment.
    For Tomcat users who don't have freedom in server choice, refer this article: How to install CDI in Tomcat?
    When installing Weld, make sure that you're using a minimum of version 2.2.0! Older versions have initialization ordering bugs.
  3. Switch to a CDI 1.1 capable environment.
    For Tomcat users who have full freedom in server choice, just replace Tomcat by TomEE, or perhaps even by WildFly.

Got it

Go back to OmniFaces homepage then :)