简体   繁体   中英

Getting FileNotFoundException when trying to upload file using icefaces Fileentry component

I am trying to upload xls file to my server through browse funtionality ,but I am getting below exception . I can see the path it is taking has null even though I am not setting any path explicitly .

java.io.FileNotFoundException: no such entry: "null\\trQYXGpMctrhhDvnJ92wDYLJ0DZw1VFyjM2TnNQTQSj2nDPD104P!1525033770!1459920524559\\IP1RateList.xls"

my method implementation

FileEntry fileEntry;
fileEntry = (FileEntry) fe.getComponent();
FileEntryResults results = fileEntry.getResults();

for (FileEntryResults.FileInfo fileInfo : results.getFiles()) {
    if (fileInfo.getFileName().endsWith(XLS)) {
        setUploadFile(fileEntry.getResults().getFiles().get(0).getFile());
        uploadDocument();
    } else {
        JavascriptContext.addJavascriptCall(
                FacesContext.getCurrentInstance(), "importExcel.hide();");
        getBaseBean().getErrorMessagesList().add(
                messageFactory.getMessage(ERROR_INVALID_EXCEL_FILE));
    }
}

my xhtml file

<ice:panelGrid>
    <ace:fileEntry id="fileEntryComponent"
        useOriginalFilename = "true"
        fileEntryListener="#{ip1ListRatesBean.loadButton}"
        maxFileCount="1"
        maxFileCountMessage="Please upload one file at a time."
        relativePath="/files/" 
        useSessionSubdir="true"
        autoUpload="false">
    </ace:fileEntry>                                                
</ice:panelGrid>

I have also added context-param in web.xml after reading few comments on the site .

<context-param>
    <param-name>org.icefaces.mandatoryResourceConfiguration</param-name>
    <param-value>fileEntry</param-value>
</context-param>

let me know in case any further information is required .

Thanks

I was getting the same error when using the xlsx format - XSSFWorkbook due to xml classloader issue. I changed to HSSFWorkbook to use older excel it resolved the issue. So look for changing the format or look if there is any issue with xml-bean loading.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM