I am reading Excel file using Apache POI, it is working fine in local machine (Standalone prog), but it is not running in server (IBM websphere). It's stopped working when it encounters to instantiate WorkBook.
Below jars are used.
commons-codec-1.5.jar poi-3.9.jar poi-examples-3.9.jar poi-ooxml-3.9.jar poi-ooxml-schemas-3.9.jar xmlbeans-2.6.0.jar
Below is my code:
String mountInFilePath = "//XXXXX/YY/Foooo/folder/";
File fileList = new File(mountInFilePath);
File[] fileNames = fileList.listFiles();
String inFileName = null;
if(fileNames != null && fileNames.length > 1){
throw new Exception("Multiple Files found in "+mountInFilePath+", Please place the latest one.");
}else{
System.out.println("getAbsolutePath: "+fileList.getAbsolutePath());
for(File file : fileNames){
System.out.println("New file path: "+file.getCanonicalPath());
inFileName = file.getCanonicalPath();
}
}
LOGGER.info("File: "+inFileName);
if(inFileName != null){
LOGGER.info("Inside IF cond...");
System.out.println("Inside IF cond...");
//Getting the workbook file
LOGGER.info("After FileInputStream...");
File chkAcc = new File(inFileName);
if(chkAcc.canRead()){
LOGGER.info("File Readable.."); //This is printed
}else{
LOGGER.info("Can not read file..");
}
Workbook workbook = WorkbookFactory.create(chkAcc); //Stopped here
//Iterating work sheet
LOGGER.info("Iterating...");
System.out.println("Iterating...");