I was trying to open the excel file for read-only using POI.The file was both workbook and sheet protected. The file couldn't be opened and caused the following exception: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct orAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC onstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.j ava:252) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory. java:190) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1 81) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1 53) at gov.moh.ohfs.submission.SPSubmissionForm.init(SPSubmissionForm.java:1 05) at gov.moh.ohfs.submission.SPSubmission.importSPData(SPSubmission.java:2 52) at gov.moh.ohfs.submission.SPSubmission.process(SPSubmission.java:192) at gov.moh.ohfs.report.generation.ReportGenController.processFacility(Re portGenController.java:387) at gov.moh.ohfs.report.generation.ReportGenController.main(ReportGenCont roller.java:621) Caused by: java.lang.IllegalArgumentException: Illegal length at org.apache.poi.util.StringUtil.getFromUnicodeHigh(StringUtil.java:112 ) at org.apache.poi.hssf.record.FontRecord.fillFields(FontRecord.java:172) at org.apache.poi.hssf.record.Record.fillFields(Record.java:143) at org.apache.poi.hssf.record.Record.<init>(Record.java:105) at org.apache.poi.hssf.record.FontRecord.<init>(FontRecord.java:125) ... 13 more org.apache.poi.hssf.record.RecordFormatException: Unable to construct record ins tance, the following exception occured: null at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.j ava:265) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory. java:190) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1 81) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1 53) at gov.moh.ohfs.submission.SPSubmissionForm.init(SPSubmissionForm.java:1 05) at gov.moh.ohfs.submission.SPSubmission.importSPData(SPSubmission.java:2 52) at gov.moh.ohfs.submission.SPSubmission.process(SPSubmission.java:192) at gov.moh.ohfs.report.generation.ReportGenController.processFacility(Re portGenController.java:387) at gov.moh.ohfs.report.generation.ReportGenController.main(ReportGenCont roller.java:621)
http://jakarta.apache.org/poi/faq.html#faq-5