title: How to install and use CDI on Tomcat?
body: <p>I'm creating my first project Java EE 7, but I'm having trouble. Appreciate any help.</p>
  
  <ul>
  <li>Tomcat 7.0.34</li>
  <li>JSF 2.2</li>
  <li>Primefaces 3.5</li>
  <li>javaee-api-7.0.jar</li>
  </ul>
  
  <p>When the application start, the Tomcat log shows the following message:</p>
  
  <pre><code>"validateJarFile (C:\...\build\web\WEB-INF\lib\javaee-api-7.0.jar)-jar not loaded. See Servlet 2.3 Spec, section 9.7.2. Offending class: javax/servlet/Servlet .class"
  </code></pre>
  
  <p>when I click on the button that calls the managed bean, I get the error:</p>
  
  <pre><code>Advertência: /index.xhtml @18,66 value="#{indexMB.user}": Target Unreachable, identifier 'indexMB' resolved to null
  javax.el.PropertyNotFoundException: /index.xhtml @18,66 value="#{indexMB.user}": Target Unreachable, identifier 'indexMB' resolved to null
  </code></pre>
  
  <p><strong>IndexMB</strong></p>
  
  <pre><code>@Named("indexMB")
  @RequestScoped
  public class IndexMB {
  
  private String password;
  private String user;
  
  public String loginTest(){
      return (this.user.equals("admin") ? "adminPage" : "inOutPage");
  }
  
  // getters and setters
  }
  </code></pre>
  
  <p><strong>index.xhtml</strong></p>
  
  <pre><code>&lt;html ...&gt;
  
  &lt;f:loadBundle basename="i18n" var="bundle" /&gt;
  &lt;h:head&gt;
      &lt;title&gt;#{bundle['index_title']}&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      #{bundle['index_appname']}
      &lt;br /&gt;
      &lt;h:form id="frmIndex"&gt;
          &lt;p:panelGrid columns="2"&gt;
              &lt;p:outputLabel for="user" value="#{bundle['lblUser']}" /&gt;
              &lt;p:inputText id="user" value="#{indexMB.user}" /&gt;
  
              &lt;p:outputLabel for="password" value="#{bundle['lblPassword']}" /&gt;
              &lt;p:password id="password" value="#{indexMB.password}" /&gt;
          &lt;/p:panelGrid&gt;
          &lt;p:commandButton action="#{indexMB.loginTest}" value="#{bundle['btn_login']}" /&gt;
      &lt;/h:form&gt; 
  &lt;/h:body&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>faces-config.xml</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;faces-config version="2.2"
  xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"&gt;
  
  &lt;application&gt;
      &lt;locale-config&gt;
          &lt;default-locale&gt;pt_BR&lt;/default-locale&gt;
          &lt;supported-locale&gt;en&lt;/supported-locale&gt;
          &lt;supported-locale&gt;fr&lt;/supported-locale&gt;
      &lt;/locale-config&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>These topics have not helped me: </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/11986847/java-ee-6-javax-annotation-managedbean-vs-javax-inject-named-vs-javax-faces">Java EE 6 @javax.annotation.ManagedBean vs. @javax.inject.Named vs. @javax.faces.ManagedBean</a></li>
  <li><a href="https://stackoverflow.com/questions/17233557/target-unreachable-identifier-resolved-to-null">Target Unreachable identifier resolved to null</a></li>
  <li><a href="https://stackoverflow.com/questions/4845041/target-unreachable-identifier-resolved-to-null">Target Unreachable, identifier resolved to null</a></li>
  <li><a href="https://stackoverflow.com/questions/18161296/javax-el-propertynotfoundexception-target-unreachable-identifier-login-reso">javax.el.PropertyNotFoundException : Target Unreachable, identifier &#39;login&#39; resolved to null Spring + JSF</a></li>
  <li><a href="http://www.andrejkoelewijn.com/blog/2010/03/05/jee-cdi-tip-target-unreachable-identifier-resolved-to-null/" rel="noreferrer">http://www.andrejkoelewijn.com/blog/2010/03/05/jee-cdi-tip-target-unreachable-identifier-resolved-to-null/</a></li>
  </ul>