Mailing List
Home
Forum Home
Maven - Project building tool
Axis - Java SOAP implementation
Lucene - Full-featured text search engine APIs
Cocoon - MVC web framework based on XML/XSL
Fop - Create PDF, PCL, PS, SVG, XML driven by XSL formatting objects.
Log4J - A log library
POI - Java Excel, Word and other Microsoft Office files manipulating library
Oracle database error code ...
Subjects
log4j warning: No appenders could be found
java security AccessControlException: access denied (java io FilePermission clie
java lang InstantiationException: org apache tools ant Main
Apache Axis Tutorial
Subject: Struts <logic iterate >
log4j properties How to parse outpu to multiple files
configuring log4j with BEA Weblogic 8 1
How to use XSL FOP Java together
JSP precompile
Proposal: Adding jar manifest classpath in jar and war plugins
Servlet File Download dialog problem (IE6,Adobe 6 0)
java security AccessControlException: access denied (java io FilePermission
Unsupported major minor version 48 0 problem while running the an
   telope task
Subject: axis wsdl2java Ant Task usage
net sf hibernate MappingException: Error reading resource: test/User hbm xml
Building EAR ANT Script for websphere 5 0
CREATING WAR Files
Classpath problem
jsp data into Excel
Jboss 3 2 3+ vs Tomcat Axis Question
RE: How to include jars and add them into the MANIFEST MF/Class Path
attribute
Printing problem
Subject: InstantiationException
Couldn 't find trusted certificate
Please : How can one install ant 1 6 0 under Eclipse 2 1 ?
Excel: Too many different cell formats
Subject: AXIS: tomcat timeout ?
1 3 final: now giving me java io FileNotFoundException (Too many
open files)
XDoclet, Struts and Maven: Where to start? SOLUTION
Subject: Running junit tests fails
 
"InvocationTargetException " while reading an Excel file.

"InvocationTargetException " while reading an Excel file.

2007-05-03       - By Anjishnu Bandyopadhyay

 Back
Reply:     1     2     3     4  


Hi all,



I am trying to read a MS Excel file through my POI code. The file
contains Filters, Macros & Pivot tables. By trying to do so, I get an
"InvocationTargetException" when I try to instantiate a new workbook,
with an instance of "POIFSFileSystem" class.



My code is something like:



     public static synchronized HSSFWorkbook getWorkbook(String
filePath)

           throws FileNotFoundException, IOException {



           FileInputStream fis = new FileInputStream(filePath);

           InputStream inputStream = new BufferedInputStream(fis);



           POIFSFileSystem fs = new POIFSFileSystem(fis);

           HSSFWorkbook workbook = new HSSFWorkbook(fs);

           inputStream.close();

           return workbook;

     }



The stack trace is as follows:



[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R
java.lang.reflect.InvocationTargetException:
java.lang.ArrayIndexOutOfBoundsException

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
java.lang.System.arraycopy(Native Method)

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62)

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.record.Record.fillFields(Record.java(Compiled Code))

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.record.Record.<init>(Record.java(Compiled Code))

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
java.lang.reflect.Constructor.newInstance(Native Method)

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java
(Compiled Code))

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.jav
a(Compiled Code))

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)

[5/3/07 12:02:19:003 IST] 26b9ee4c SystemErr     R    at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)





Is its possible to bypass the problem?

Thanks for your time.



With best regards,

Anjishnu.





**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are
not to copy, disclose, or distribute this e-mail or its contents to any other
person and any such actions are unlawful. This e-mail may contain viruses.
Infosys has taken every reasonable precaution to minimize this risk, but is not
liable for any damage you may sustain as a result of any virus in this e-mail.
You should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content of all
messages sent to or from this e-mail address. Messages sent to or from this e
-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***