title: Omnifaces exception on deployment on Tomcat 7
body: <p>I'm trying to add Omnifaces 2.1 to a web application to use FullAjaxExceptionHandler and possibly other functionality in Omnifaces 2.1.</p>
  
  <p>I've read and followed following post by BallusC and am still stuck:
  <a href="https://stackoverflow.com/questions/18995951/how-to-install-and-use-cdi-on-tomcat/19003725#19003725">How to install and use CDI on Tomcat?</a></p>
  
  <p>Tried to install Weld 2.2.9.Final and configure as described above.  I am using the following:</p>
  
  <p>JSF 2.2, EL 2.2, Servlet 3, Java 7</p>
  
  <p>web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee" 
      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      id="{name}" version="3.0"&gt;
  </code></pre>
  
  <p>Upon startup I am still getting the following exception:</p>
  
  <p>Catalina.log:</p>
  
  <pre><code>INFO: Starting service Catalina
  Aug 09, 2015 8:57:18 AM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.56
  Aug 09, 2015 8:57:18 AM org.apache.catalina.startup.HostConfig deployDescriptor
  INFO: Deploying configuration descriptor C:\xampp\tomcat\conf\Catalina\localhost\MITrace.xml
  Aug 09, 2015 8:57:24 AM org.richfaces.webapp.ResourceServletContainerInitializer registerServlet
  INFO: Auto-registered servlet ResourceServlet with mapping '/org.richfaces.resources/*'
  Aug 09, 2015 8:57:24 AM org.omnifaces.ApplicationInitializer logOmniFacesVersion
  INFO: Using OmniFaces version 2.1
  Aug 09, 2015 8:57:26 AM com.sun.faces.config.ConfigureListener contextInitialized
  INFO: Initializing Mojarra 2.2.6 ( 20140304-1537 https://svn.java.net/svn/mojarra~svn/tags/2.2.6@12949) for context '/MITrace'
  Aug 09, 2015 8:57:27 AM com.sun.faces.spi.InjectionProviderFactory createInstance
  INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
  Aug 09, 2015 8:57:27 AM com.sun.faces.config.ConfigureListener contextInitialized
  SEVERE: Critical error during deployment: 
  java.lang.NoClassDefFoundError: Could not initialize class org.omnifaces.config.BeanManager
      at org.omnifaces.application.OmniApplication.&lt;init&gt;(OmniApplication.java:69)
      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:144)
      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:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      at java.lang.Class.newInstance(Class.java:379)
      at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:721)
      at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:553)
      at javax.faces.FactoryFinder.access$500(FactoryFinder.java:140)
      at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1120)
      at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
      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:435)
      at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:672)
      at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1861)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Localhost.log:</p>
  
  <pre><code>Aug 09, 2015 10:28:23 PM org.apache.catalina.core.ApplicationContext log
  INFO: No Spring WebApplicationInitializer types detected on classpath
  Aug 09, 2015 10:28:25 PM org.apache.catalina.core.ApplicationContext log
  INFO: Initializing Spring root WebApplicationContext
  Aug 09, 2015 10:28:27 PM org.apache.catalina.core.StandardContext listenerStart
  SEVERE: Exception sending context initialized event to listener instance of class org.omnifaces.ApplicationListener
  java.lang.ExceptionInInitializerError
      at org.omnifaces.ApplicationListener.checkCDIAvailable(ApplicationListener.java:63)
      at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:55)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:672)
      at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1861)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      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:99)
      at org.omnifaces.config.BeanManager.&lt;clinit&gt;(BeanManager.java:49)
      ... 15 more
  Caused by: java.lang.IllegalStateException: javax.naming.NamingException: Cannot create resource instance
      at org.omnifaces.util.JNDI.lookup(JNDI.java:92)
      at org.omnifaces.config.BeanManager.&lt;init&gt;(BeanManager.java:95)
      ... 16 more
  Caused by: javax.naming.NamingException: Cannot create resource instance
      at org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(ResourceEnvFactory.java:115)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
      at javax.naming.InitialContext.lookup(InitialContext.java:411)
      at org.omnifaces.util.JNDI.lookup(JNDI.java:88)
      ... 17 more
  </code></pre>
  
  <p>The jar does indeed exist and has been added to the application.</p>
  
  <p>What else could be causing this error?</p>