title: java.lang.IllegalStateException: CDI API is not available in this environment. at org.omnifaces.config.BeanManager
body: <p>I m trying to display an image from a managed bean method which returns <code>byte[]</code> with <code>&lt;o:graphicImage&gt;</code> using omnifaces  i deployed omnifaces 2.1 in <code>WEB_INF/lib</code>
  here is my code</p>
  
  <p>Register.java</p>
  
  <pre><code>public byte[] getImage() throws IOException{
  return Utils.toByteArray(Faces.getResourceAsStream("/resources/images/loader.gif"));
  
  
          }
  </code></pre>
  
  <p>Home.xhtml</p>
  
  <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:o="http://omnifaces.org/ui"&gt;
  &lt;h:head&gt;
  &lt;h:outputStylesheet library="css" name="style.css"&gt;&lt;/h:outputStylesheet&gt;
      &lt;style&gt;
  .center {
      align: center;
  }
  &lt;/style&gt;
  
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;h:form&gt;
      &lt;table style="float:right;margin-top:5px;"&gt;
          &lt;tr&gt;&lt;td&gt;&lt;h:commandLink action="/user/second.xhtml" style="float:right;"&gt;Second page&lt;/h:commandLink&gt;&lt;/td&gt;
          &lt;td&gt;&lt;h:commandLink action="#{login.logout}" style="float:right;"&gt;Logout&lt;/h:commandLink&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;        
      &lt;/h:form&gt;
      &lt;h:form&gt;
          &lt;div style="margin: auto;"&gt;
              &lt;h:messages globalOnly="true" infoStyle="display:none" styleClass="error" style="list-style-type:none;"/&gt;
              &lt;h:messages globalOnly="true"  errorStyle="display:none" styleClass="green" style="list-style-type:none;"/&gt;
              &lt;h4 align="center"&gt;Welcome to JSF #{login.username} Dude&lt;/h4&gt;
  
              &lt;h3 align="center"&gt;User Profile&lt;/h3&gt;
              &lt;h:dataTable value="#{register.getUser(login.username)}" var="info"
                  styleClass="center" style="margin:auto;" border="1"&gt;
                  &lt;h:column&gt;
                  &lt;f:facet name="header"&gt;Image&lt;/f:facet&gt;
                   &lt;o:graphicImage value="#{register.getImage()}" type="jpg" dataURI="true"/&gt;
                  &lt;/h:column&gt;
  
                  &lt;h:column&gt;
                      &lt;!-- column header --&gt;
                      &lt;f:facet name="header"&gt;Email&lt;/f:facet&gt;
                      &lt;!-- row record --&gt;
                                          &lt;h:outputText value="#{info.email}"
                                              rendered="#{not  register.edit}" /&gt;
  &lt;!--                    &lt;h:inputText value="#{info.email}" rendered="#{not register.edit}" /&gt; --&gt;
                  &lt;/h:column&gt;
                  &lt;h:column&gt;
                      &lt;!-- column header --&gt;
                      &lt;f:facet name="header"&gt;First Name&lt;/f:facet&gt;
                      &lt;!-- row record --&gt;
  
                                          &lt;h:outputText value="#{info.first}" rendered="#{not  register.edit}" /&gt;
  &lt;!--                    &lt;h:inputText value="#{info.first}" rendered="#{not register.edit}" /&gt; --&gt;
                  &lt;/h:column&gt;
                  &lt;h:column&gt;
                      &lt;!-- column header --&gt;
                      &lt;f:facet name="header"&gt;Last name&lt;/f:facet&gt;
                      &lt;!-- row record --&gt;
  
                                          &lt;h:outputText value="#{info.last}" rendered="#{not  register.edit}" /&gt;
  &lt;!--                    &lt;h:inputText value="#{info.last}" rendered="#{not register.edit}" /&gt; --&gt;
                  &lt;/h:column&gt;
                  &lt;h:column&gt;
                      &lt;!-- column header --&gt;
                      &lt;f:facet name="header"&gt;Phone&lt;/f:facet&gt;
                      &lt;!-- row record --&gt;
  
                                          &lt;h:outputText value="#{info.phone}"
                                              rendered="#{not  register.edit}" /&gt;
  &lt;!--                    &lt;h:inputText value="#{info.phone}" rendered="#{not register.edit}" /&gt; --&gt;
                  &lt;/h:column&gt;
                  &lt;h:column&gt;
                      &lt;h:commandButton value="Update" action="/user/Updateprofile.xhtml"&gt;
  
                      &lt;/h:commandButton&gt;
  
                  &lt;/h:column&gt;
  
              &lt;/h:dataTable&gt;
          &lt;/div&gt;
      &lt;/h:form&gt;
  
  
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>At first tomcat got started shown this error <code>&lt;o:graphicImage&gt; Tag Library supports namespace: http://omnifaces.org/ui, but no tag was defined for name: graphicImage]</code> when i have added the omnifaces.jar into my build path in eclipse. After the <code>omnifaces.jar</code> in <code>WEB-INF/lib</code> 
  it is not letting the tomcat to start and showing the following error</p>
  
  <pre><code>   java.lang.ExceptionInInitializerError
      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 org.apache.myfaces.config.FacesConfigurator.configureApplication(FacesConfigurator.java:1926)
      at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:529)
      at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:296)
      at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
      at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:118)
      at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:111)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.IllegalStateException: CDI API is not available in this environment.
      at org.omnifaces.config.BeanManager.&lt;init&gt;(BeanManager.java:88)
      at org.omnifaces.config.BeanManager.&lt;clinit&gt;(BeanManager.java:49)
      ... 18 more
  Caused by: java.lang.ClassNotFoundException: javax.enterprise.inject.spi.BeanManager
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at org.omnifaces.config.BeanManager.&lt;init&gt;(BeanManager.java:82)
      ... 19 more
  
  Jul 23, 2015 5:16:06 PM org.apache.catalina.core.StandardContext listenerStart
  SEVERE: Exception sending context initialized event to listener instance of class org.omnifaces.ApplicationListener
  java.lang.NoClassDefFoundError: Could not initialize class org.omnifaces.config.BeanManager
      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:5016)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  
  Jul 23, 2015 5:16:06 PM org.apache.catalina.core.StandardContext startInternal
  SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
  Jul 23, 2015 5:16:06 PM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Context [/First] startup failed due to previous errors
  Jul 23, 2015 5:16:06 PM org.apache.catalina.core.StandardContext listenerStop
  SEVERE: Exception sending context destroyed event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
  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 org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:131)
      at org.apache.myfaces.webapp.AbstractFacesInitializer._dispatchApplicationEvent(AbstractFacesInitializer.java:239)
      at org.apache.myfaces.webapp.AbstractFacesInitializer.destroyFaces(AbstractFacesInitializer.java:273)
      at org.apache.myfaces.webapp.StartupServletContextListener.contextDestroyed(StartupServletContextListener.java:153)
      at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5063)
      at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5723)
      at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>I am using <strong>JSF 2.0(Apache Myfaces)</strong>, and i also have <strong>tomahawk 1.1.14</strong> used for uploading the file.</p>