Error reading Excel .XLSX with Apache POI
I am using Apache POI 3.8 libraries to read an XLSX file in a web application. The following code works perfectly fine from a Java console app: InputStream inputFS = new FileInputStream("test.xlsx"); Workbook workbook = new XSSFWorkbook(inputFS); // below exception is thrown on this line Sheet sheet = workbook.getSheetAt(0); but throws a "read error" when used in the web application. A relevant extract of the stack trace is pasted below: java.io.IOException: Read error at java.io.FileInputStream.readBytes(Native Method) ~[na:1.6.0_31] at java.io.FileInputStream.read(Unknown Source) ~[na:1.6.0