title: fileUploadListener is never called ( primefaces 5.0 )
body: <p>I'm trying to upload a file using PrimeFaces, but the fileUploadListener method isn't being invoked after the upload finishes. I add the jar commons-io and commons-fileupload.</p>
  
  <p>I am using </p>
  
  <ul>
  <li>glassifish 3.1</li>
  <li>primafaces 5.0 </li>
  <li>eclipseLink </li>
  <li>jsf 2. </li>
  </ul>
  
  <p>I searched a lot but nothing worked. This is my code.</p>
  
  <p>The managed Bean : </p>
  
  <pre class="lang-java prettyprint-override"><code>package image;
  import java.io.IOException;
  import java.io.InputStream;
  
  import javax.ejb.EJB;
  import javax.enterprise.context.SessionScoped;
  import javax.faces.bean.ManagedBean;
  
  import org.apache.commons.io.IOUtils;
  import org.primefaces.event.FileUploadEvent;
  import org.primefaces.model.UploadedFile;
  
  
  @ManagedBean(name="uploadBean")
  @SessionScoped
  public class UploadBean {
  
  private UploadedFile file;
  private Fichier fichier;
  
  @EJB
  private FichierDao fichierDao;
  
  public UploadBean()
  {
      fichier = new Fichier();
  }
  public void handleFileUpload(FileUploadEvent event) {
     file= event.getFile();
    // System.out.print("gfghfhgf"+file.getSize());
  
  }
  // Store file in the database
  public void storeImage() {
  
      System.out.println("11111mamlamlmalmalmlkljkjkhkjhjhjghj");
      try {
          InputStream is =file.getInputstream() ;
          fichier.setKey(IOUtils.toByteArray(is));
          System.out.println("22222222mamlamlmalmalmlkljkjkhkjhjhjghj");
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          System.out.println("33333333333mamlamlmalmalmlkljkjkhkjhjhjghj");
      }
      System.out.println("44444444444mamlamlmalmalmlkljkjkhkjhjhjghj");
  
      fichierDao.create(fichier);
      System.out.println("55555555555mamlamlmalmalmlkljkjkhkjhjhjghj");
  }
  
  public UploadedFile getFile() {
      return file;
  }
  
  public void setFile(UploadedFile file) {
      this.file = file;
  }
  
  public Fichier getFichier() {
      return fichier;
  }   
  }
  </code></pre>
  
  <p>the page xhtml</p>
  
  <pre class="lang-xml prettyprint-override"><code>   &lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"&gt;
  &lt;h:head&gt;
      &lt;meta charset="utf-8" /&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;h:outputText value="PrimeFaces Single Upload"
          style="font:30px bold; margin-left:15%;" /&gt;
      &lt;h:form enctype="multipart/form-data"&gt;
          &lt;p:fileUpload
          fileUploadListener="#{uploadBean.handleFileUpload}" ajax="false"
              mode="advanced"
              label="Choisir une image"
              update="messages" 
              sizeLimit="100000" 
              fileLimit="1"
              invalidSizeMessage="La taille maximale du fichier est 1  Megabyte !"
              invalidFileMessage="Charger des images"
              allowTypes="/(\.|\/)(gif|jpe?g|png)$/" /&gt;
          &lt;p:growl id="messages" showDetail="true" /&gt;
  
       &lt;p:commandButton value="Submit"  action="#{uploadBean.storeImage}" /&gt;
      &lt;/h:form&gt;
  
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>web.xml :</p>
  
  <pre class="lang-xml prettyprint-override"><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"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      id="WebApp_ID" version="3.0"&gt;
      &lt;!-- Changer cette valeur à "Production" lors du déploiement final de l'application --&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;context-param&gt;
          &lt;param-name&gt;primefaces.UPLOADER&lt;/param-name&gt;
          &lt;param-value&gt;commons&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;
              javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
          &lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;/filter-name&gt;
          &lt;filter-class&gt;org.primefaces.webapp.filter.FileUploadFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;thresholdSize&lt;/param-name&gt;
              &lt;param-value&gt;10240&lt;/param-value&gt; &lt;!-- 10 Mb --&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;/filter-name&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
      &lt;/filter-mapping&gt;
  
      &lt;!-- Déclaration du contrôleur central de JSF : la FacesServlet --&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;!-- Mapping : association des requêtes dont le fichier porte l'extension 
          .xhtml à la FacesServlet --&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
      &lt;/servlet-mapping&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;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
      &lt;/servlet-mapping&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;welcome-file-list&gt;
          &lt;welcome-file&gt;page1.xhtml&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;`
  </code></pre>