Omnifaces-Exception: CDI BeanManager instance is not available in JNDI
<p>i have problems with deploying my jsf-application on the upserver. starting tomcat results in the following exception:</p>

<pre><code>14-Jul-2016 07:26:52.661 SEVERE [localhost-startStop-1] com.sun.faces.config.ConfigureListener.contextInitialized Critical error during deployment: 
 java.lang.ExceptionInInitializerError
    at org.omnifaces.util.Beans.getManager(Beans.java:88)
    at org.omnifaces.util.Beans.getReference(Beans.java:113)
    at org.omnifaces.application.OmniApplication.&lt;init&gt;(OmniApplication.java:70)
    at org.omnifaces.application.OmniApplicationFactory.createOmniApplication(OmniApplicationFactory.java:89)
    at org.omnifaces.application.OmniApplicationFactory.getApplication(OmniApplicationFactory.java:54)
    at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:93)
    at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
    at com.sun.faces.lifecycle.ClientWindowFactoryImpl.&lt;init&gt;(ClientWindowFactoryImpl.java:62)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at javax.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:405)
    at javax.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:251)
    at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:543)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:283)
    at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:328)
    at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:236)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:439)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: CDI BeanManager instance is not available in JNDI.
    at org.omnifaces.config.BeanManager.&lt;init&gt;(BeanManager.java:97)
    at org.omnifaces.config.BeanManager.&lt;clinit&gt;(BeanManager.java:47)
    ... 30 more
Caused by: java.lang.IllegalStateException: javax.naming.NamingException: Cannot create resource instance
    at org.omnifaces.util.JNDI.lookup(JNDI.java:95)
    at org.omnifaces.config.BeanManager.&lt;init&gt;(BeanManager.java:93)
    ... 31 more
Caused by: javax.naming.NamingException: Cannot create resource instance
    at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:96)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:841)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:166)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:157)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at org.omnifaces.util.JNDI.lookup(JNDI.java:90)
    ... 32 more

14-Jul-2016 07:26:52.665 SEVERE [localhost-startStop-1] org.omnifaces.ApplicationListener.checkCDIAvailable 
????????????????????????????????????????????????????????????????????????????????
?                         ??     ?                                             ?
?    ?                  ?????    ? OmniFaces failed to initialize!             ?
?   ????               ??????    ?                                             ?
?   ??????            ???????    ? This OmniFaces version requires CDI, but    ?
?   ???????          ???????     ? none was found on this environment.         ?
?    ???????????????????????     ?                                             ?
?    ???????????????????????     ? OmniFaces 2.x requires a minimum of JSF 2.2.?
?     ?????????????????????      ? Since this JSF version, the JSF managed bean?
?     ?????????????????????      ? facility @ManagedBean is semi-official      ?
?     ??????????????????????     ? deprecated in favour of CDI. JSF 2.2 users  ?
?     ??????????????????????     ? are strongly encouraged to move to CDI.     ?
?     ??????????????????????     ?                                             ?
?    ???????????????????????     ? OmniFaces goes a step further by making CDI ?
?    ????????????????????????    ? a REQUIRED dependency next to JSF 2.2. This ?
?    ????????????????????????    ? not only ensures that your web application  ?
?   ???????????????? ????????    ? represents the state of art, but this also  ?
?   ?????????????????????????    ? makes for us easier to develop OmniFaces,   ?
?   ??????????????????????????   ? without the need for all sorts of hacks in  ?
?   ??????????????????????????   ? in order to get OmniFaces to deploy on      ?
?  ????????????????????????????  ? environments without CDI.                   ?
?  ????????????????????????????  ?                                             ?
?  ????????????????????????????  ? 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                    ?
??????????????????????????????????                                             ?
????????????????????????????????????????????????????????????????????????????????
14-Jul-2016 07:26:52.682 INFO [localhost-startStop-1] com.sun.faces.config.ConfigureListener.contextInitialized Initializing Mojarra 2.2.12 ( 20150720-0848 https://svn.java.net/svn/mojarra~svn/tags/2.2.12@14885) for context '/protano'
14-Jul-2016 07:26:52.840 INFO [localhost-startStop-1] com.sun.faces.spi.InjectionProviderFactory.createInstance JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
14-Jul-2016 07:26:52.872 SEVERE [localhost-startStop-1] com.sun.faces.config.ConfigureListener.contextInitialized Critical error during deployment: 
 java.lang.NoClassDefFoundError: Could not initialize class org.omnifaces.config.BeanManager
    at org.omnifaces.util.Beans.getManager(Beans.java:88)
    at org.omnifaces.util.Beans.getReference(Beans.java:113)
    at org.omnifaces.application.OmniApplication.&lt;init&gt;(OmniApplication.java:70)
    at org.omnifaces.application.OmniApplicationFactory.createOmniApplication(OmniApplicationFactory.java:89)
    at org.omnifaces.application.OmniApplicationFactory.getApplication(OmniApplicationFactory.java:54)
    at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:93)
    at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
    at com.sun.faces.lifecycle.ClientWindowFactoryImpl.&lt;init&gt;(ClientWindowFactoryImpl.java:62)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at javax.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:405)
    at javax.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:251)
    at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:543)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:283)
    at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:328)
    at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:236)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:439)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4840)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

14-Jul-2016 07:26:52.889 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start.
</code></pre>

<p>in my local enviroment it works fine. i already checked all affected files for presence and values:</p>

<p><strong>WEB-INF</strong><br>
-(empty) beans.xml</p>

<p><strong>WEB-INF/lib</strong><br>
-cdi-api-1.2.jar<br>
-weld-servlet-2.2.9.Final.jar</p>

<p><strong>META-INF</strong><br>
context.xml with following content:</p>

<pre><code> &lt;Context&gt;
   &lt;Resource name="BeanManager" 
      auth="Container"
      type="javax.enterprise.inject.spi.BeanManager"
      factory="org.jboss.weld.resources.ManagerObjectFactory"/&gt;
 &lt;/Context&gt;
</code></pre>

<p><strong>Enviroment:</strong><br> 
java 8<br>
mojarra 2.2.12<br>
omnifaces 2.4<br>
tomcat: 8.0.36 with cdi installed, carefully followed the steps given here:<br>
<a href="http://balusc.omnifaces.org/2013/10/how-to-install-cdi-in-tomcat.html" rel="nofollow noreferrer">http://balusc.omnifaces.org/2013/10/how-to-install-cdi-in-tomcat.html</a></p>

<p>there is a similar topic which is not helpful. for me the solution is unclear. 
<a href="https://stackoverflow.com/questions/31899406/omnifaces-exception-on-deployment-on-tomcat-7">Omnifaces exception on deployment on Tomcat 7</a></p>

<p>any other help/advice would be much appreciated.</p>