title: Trying to use CDI on Glassfish 4 results in javax.el.PropertyNotFoundException: Target Unreachable, identifier 'indexMB' resolved to null
body: <p>I am getting an error on a single page, and the only error occurs after I click the SUBMIT button.</p>
  
  <blockquote>
    <p>javax.el.PropertyNotFoundException: Target Unreachable, identifier 'indexMB' resolved to null</p>
  </blockquote>
  
  <p>I followed the recommendations of the topic <a href="https://stackoverflow.com/questions/13273731/jsf2-form-submit-target-unreachable-identifier-mymodel-resolved-to-null-onl">JSF2 form submit " Target Unreachable, identifier 'myModel' resolved to null ONLY on submit</a> but did not help me.</p>
  
  <p>Any help will be very useful.</p>
  
  <p>Follow my setup and my files:</p>
  
  <ul>
  <li>Glassfish 4</li>
  <li>Primefaces 3.5</li>
  <li>commons-fileupload 1.3</li>
  <li>commons-io 2.4</li>
  </ul>
  
  <p><code>index.xhtml</code></p>
  
  <pre><code>&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><code>IndexMB.java</code></p>
  
  <pre><code>@ManagedBean ("indexMB")
  @RequestScoped
  public class IndexMB {
  
  private String password;
  private String user;
  
  public IndexMB() {
  }
  
  public String loginTest(){
     ...
  }
  
  // getters and setters
  }
  </code></pre>
  
  <p>log (Glassfish)</p>
  
  <pre><code>javax.el.PropertyNotFoundException: /index.xhtml @18,66 value="#{indexMB.user}": Target Unreachable, identifier 'indexMB' resolved to null
      at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
      at org.primefaces.renderkit.InputRenderer.findImplicitConverter(InputRenderer.java:170)
      at org.primefaces.renderkit.InputRenderer.findConverter(InputRenderer.java:190)
      at org.primefaces.renderkit.InputRenderer.getConvertedValue(InputRenderer.java:196)
      at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1046)
      at javax.faces.component.UIInput.validate(UIInput.java:976)
      at javax.faces.component.UIInput.executeValidate(UIInput.java:1249)
      at javax.faces.component.UIInput.processValidators(UIInput.java:712)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
      at javax.faces.component.UIForm.processValidators(UIForm.java:253)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
      at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
      at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      at java.lang.Thread.run(Thread.java:724)
      Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'indexMB' resolved to null
      at com.sun.el.parser.AstValue.getTarget(AstValue.java:174)
      at com.sun.el.parser.AstValue.getType(AstValue.java:86)
      at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:201)
      at org.jboss.weld.el.WeldValueExpression.getType(WeldValueExpression.java:93)
      at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
      ... 43 more
  </code></pre>
  
  <p><code>web.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;
          &lt;param-value&gt;Development&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;
              30
          &lt;/session-timeout&gt;
      &lt;/session-config&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;faces/index.xhtml&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><code>faces-config.xml</code></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;
  &lt;/faces-config&gt;
  </code></pre>
  
  <p><code>beans.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"&gt;
  &lt;/beans&gt;
  </code></pre>