title: Target Unreachable when importing file using jsf
body: <p>I'm new to Java-ee development, and I'm really confused about this. In fact i wanna to import file using jsf and save this file in a directory but i got always <strong>Target Unreachable</strong>. this is my bean:</p>
  
  <pre><code>@ManagedBean
  @RequestScoped
  
  public class Import_2G {
  
      //@EJB
      //private GestionCellRef2GLocal gestionCellRef2GLocal;
  
      private UploadedFile uploadedFile;
  
      public void save() throws IOException {
          //GestionCellRef2GRemote t = null;
  
          Path folder = Paths.get("C:\\Upload");
          String filename = FilenameUtils.getBaseName(uploadedFile.getFileName());
          String extension = FilenameUtils.getExtension(uploadedFile.getFileName());
          Path file = Files.createTempFile(folder, filename + "-", "." + extension);
          //try (InputStream input = uploadedFile.getInputstream()) {
            //  Files.copy(input, folder, StandardCopyOption.REPLACE_EXISTING);
              if (file != null) {
                  FacesMessage message = new FacesMessage("Succesful", file.getFileName() + " was uploaded.");
                  FacesContext.getCurrentInstance().addMessage(null, message);
              }
  
  
  }
  }
  </code></pre>
  
  <p>and this is the xhtml file :</p>
  
  <pre><code>   &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:jsf="http://xmlns.jcp.org/jsf"
      xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
      xmlns:p="http://primefaces.org/ui"
      template="/WEB-INF/template/template.xhtml"&gt;
  &lt;ui:define name="title"&gt;2G&lt;/ui:define&gt;
  
  
      &lt;ui:define name="content"&gt;
      &lt;h:form&gt;
  
      &lt;h1&gt; &lt;font color="orange" size="7" &gt; 2G&lt;/font&gt;&lt;/h1&gt; 
  
  
      &lt;/h:form&gt;
      &lt;h2 &gt;Choose 2 files &lt;/h2&gt;
      &lt;h:form&gt;
              &lt;p:fileUpload fileUploadListener="#{Import_2G.save()}"
                  mode="advanced" dragDropSupport="true" update="messages"
                  sizeLimit="100000000000" allowTypes="/(\.|\/)(xls)$/" /&gt;
  
              &lt;p:growl id="messages" showDetail="true" /&gt;
          &lt;/h:form&gt;
      &lt;/ui:define&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>and this is the errors that i got :</p>
  
  <blockquote>
    <p>WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (default task-55) /admin/2g.xhtml @23,61 fileUploadListener="#{Import_2G.save()}": Target Unreachable, identifier 'Import_2G' resolved to null: javax.el.PropertyNotFoundException: /admin/2g.xhtml @23,61 fileUploadListener="#{Import_2G.save()}": Target Unreachable, identifier 'Import_2G' resolved to null</p>
  </blockquote>