This is in reference to the following thread [File upload doesn't work with AJAX in PrimeFaces 4.0/JSF 2.2.x - javax.servlet.ServletException: The request content-type is not a multipart/form-data
The problem I experience is Nullpointer on clicking the command button.
Starting from the web.xml
<context-param>
    <param-name>primefaces.UPLOADER</param-name>
    <param-value>commons</param-value>
</context-param>
xhtml
<p:fileUpload id="file" value="#{userBean.uploadedFile}"
                    mode="simple" required="true" allowTypes="*.xls,*.xlsx"
                    requiredMessage="#{msg.vrUserUpload}"
                    invalidFileMessage="#{msg.vrUserUploadInvalidFile}"
                    multiple="false" fileUploadListener="userBean.fileUploadListener" />
<p:commandButton id="btnUpload" value="#{displayText.btUpload}"
                        styleClass="button_lite" actionListener="#{userBean.insert}"
                        ajax="true" update="userMassUploadForm"
                        process="userMassUploadForm">
                    </p:commandButton>
UserBean.java
public void fileUploadListener(FileUploadEvent event)
    {
        uploadedFile = event.getFile();
    }
    public void insert(){
         if(uploadedFile!=null){
                System.out.println(uploadedFile.getFileName());
            }
            else{
                System.out.println("The file object is null.");
            }
    }
Console prints out "The file object is null." whenever ajax="true" and when set to false, works. I could not find a solution for this in the above referred thread. Please advise.Also please let me know if you want any further information.
 
     
    