POI Excel RecordFormatException

I'm getting a recordformatexception when I try to open an excel file using poi. My class works with other xls files, but the one I want to use crashes at runtime. Maybe someone can decipher the stack trace and help me out.
Stack Trace
Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException: Una
ble to construct record instance
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.j
ava:186)
        at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.
java:328)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:2
71)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1
96)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1
78)
        at ExcelGenerator.<init>(ExcelGenerator.java:40)
        at ExcelGenerator.main(ExcelGenerator.java:30)
Caused by: java.lang.RuntimeException: resource 'functionMetadata.txt' not found
        at org.apache.poi.hssf.record.formula.function.FunctionMetadataReader.cr
eateRegistry(FunctionMetadataReader.java:58)
        at org.apache.poi.hssf.record.formula.function.FunctionMetadataRegistry.
getInstance(FunctionMetadataRegistry.java:41)
        at org.apache.poi.hssf.record.formula.function.FunctionMetadataRegistry.
getFunctionByIndex(FunctionMetadataRegistry.java:57)
        at org.apache.poi.hssf.record.formula.FuncPtg.<init>(FuncPtg.java:42)
        at org.apache.poi.hssf.record.formula.Ptg.createClassifiedPtg(Ptg.java:1
04)
        at org.apache.poi.hssf.record.formula.Ptg.createPtg(Ptg.java:85)
        at org.apache.poi.hssf.record.formula.Ptg.readTokens(Ptg.java:54)
        at org.apache.poi.hssf.record.FormulaRecord.<init>(FormulaRecord.java:20
2)
        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:513)
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.j
ava:184)
        ... 6 more
Press any key to continue . . .Edited by: dbillings on Oct 11, 2009 4:57 PM

resource 'functionMetadata.txt' not foundSomething is missing

Similar Messages

  • How to append poi excel files?

    Hi All,
    I am using POI excel files and this is my code to create an excel sheet.
    for(i=0;i<i<files.length();i++)
    String excel=excelFiles[i]
    Date date=  new Date();
      int  rowCount= 45;
    Sample samp=new Sample();
    samp.createWorkbookForLogReport(excel,date,rowCount);
        private HSSFWorkbook createWorkbookForLogReport(String excel,Date date,int rowCount) throws IOException {
            HSSFWorkbook wb = new HSSFWorkbook();
            HSSFSheet sheet = wb.createSheet("new sheet");
            int idx = 0; // rows index
            HSSFRow row = sheet.createRow((short)idx);
            idx++;
            String[] attributessss =
            { "ExcelName", "Date and Time", "RowCount" };
            for (int j = 0; j < attributessss.length; j++) {
                attribute = attributessss[j];
                row.createCell((short)j).setCellValue((String)attribute);
                row = sheet.createRow((short)idx);
                row.createCell((short)0).setCellValue((String)excelFiles);
                row.createCell((short)1).setCellValue(date);
                row.createCell((short)2).setCellValue(rowCount);
                idx++;
            return wb;
    the parametres are continuously changing i am able to write once in the excel file.but couldnt able to append the same excel file.is there any possibility to append the single excel file for changing records.

    is it Not possible?

  • ����poi������EXCEl����

    ����poi������EXCEl������������������������������������������������������

    The only 2 words i can make out are: poi and EXCEI, god knows what those 2 mean (i hope it's not excel).
    okay, enough fun had, please post normal questions here AND IN ENGLISH!

  • Apache Poi Excel Question

    If I use Apacha Poi to create an xls on a machine that doesn't have excel, can I still read the values using Apache Poi HSSF of the create xls?

    yes, POI is independent of Excel being installed.

  • Jakata POI excel: get column name

    Hi All
    Is there a way I can get column name where a particular cell is: (In excel spreadsheet)
    Ex: If I have column number 2: I should get "C" ( given col numbers are 0 based).
    Please let me know.
    Thanks
    bib

    It's not as easy as it might seem, since the letter sequence system is not compatible with common numeric sequence system.
    See here:
    [Java, POI - Converting number to Excel columns letter names|http://ondra.zizka.cz/stranky/programovani/java/converting_number_to_excel_column_letters_name.texy]

  • Background color in POI (Excel report from java)

    I'm generating report in Excel from Java.how can background color is set for single cell.

    i write code like
    style.setFillBackgroundColor(HSSFCellStyle.RED);
    it shows error that can not resolve symbol variable RED.why?give me solution

  • Open an excel file in a jsp

    using apache poi excel, i created a workbook and add that into the season and opened in new jsp by servletoutputstream(these are happening at onclick).
    first time it's working fine,
    if i try do it again without closing this jsp, I am getting the same results in the previous jsp.But this works fine if i close the the jsp and do that.
    regards
    Senthil Arjunan

    duffymo wrote:
    SoulTech2012 wrote:
    duffymo wrote:
    That's fine, but you can serve up an Excel file (for download) with a couple lines of code. That doesn't require Spring. Too often I see these noobs working on a web project and throwing half a dozen frameworks at it because people told them to or recommended them. Noobs don't often know better and I have no doubt that some of them would attempt to use Spring just to get an Excel file to download if they were told to. But then again, that's their problem I guess.You win. What did I win?The debate, of course.
    Do you realize how often this question is asked and how many times the code has been posted?! No, which is why I asked. Please post them just one more time.Nobody likes a smart@ss. I seriously doubt, as much time as you spend here, that you truly believe that. Yes, I'm calling you a liar.
    >
    Besides, I have no interest in helping to set a precident that there's no need to do any research when you can simply ask for a handout here. Posting the code, or not, is still a better response than recommending Spring.Fine. Post the code.
    %knock yourself out!
    in 60 seconds I found a half dozen posts of the same exact code
    http://search.sun.com/search/onesearch/index.jsp?qt=download+excel+file&rfsubcat=&col=developer-forums&cs=false&rt=true&reslang=en

  • POI Help in setting the cell type to Integer.

    Hi,
    Iam facing problem in POI generated excel sheets.
    In some cells Iam writing numeric values.....Its writing properly...
    But Iam unable to use operations like "SUM" on these kind of cells...
    My doubt is still the cell type is being set as String....The part of code I used to set it as numeric is
    <code>
    row.createCell((short)2).setCellTypeHSSFCell.CELL_TYPE_NUMERIC);
    </code>
    Is there any more thing to do so that.....I can enjoy the default features of Excel sheets on my own generated POI excel sheets....
    PLz help me....Any help will be greatly appreciated....
    Thanks in advance,,
    PLz ask me.....If the problem is not clear........

    Can u plz send the Jakarta url for POI help u
    mentioned above............http://www.google.com/search?hl=en&q=jakarta+poi
    What a time-waster.

  • Regarding Excel file reading

    HI All,
    I am trying to read a EXCEL file from Jakarta POI Excel Api.All works fine.But When the reading file if the cell value is like 74100000000000 I am getting the output like this 7.41E13.Even i formatted the cell to the number,Text etc But no luck

    All right, I'm the first to admit things need to be "dumbed down" for me.
    One of my problems with technology in general is that too often it is assumed one is born with some specialized knowledge.
    When I clicked on the above link, my first thought was, "What does POI stand for?"
    I searched the site for a definition and also "googled" it.
    Nothing.
    My second thought was that it seems another layer of software, which looks just as complex as Java itself, is required to be able to read a spreadsheet. Why is there no package equivalent to java.sql? Is this just another result of the old battle between Sun and Microsoft and the browser wars of the nineties?

  • Getting exception in reading .xlsm and .xlsx using POI

    I m trying to read .xls,.xlsm and .xlsx sheet.
    Code works properly if tried to read .xls sheet but shows exception if tried to read .xlsm and .xlsx sheet. I have configured necessary jars file in my classpath-
    poi-3.8-20120326.jar,
    poi-examples-3.8-20120326.jar,
    poi-excelant-3.8-20120326.jar,
    poi-ooxml-3.8-20120326.jar,
    poi-ooxml-schemas-3.8-20120326.jar,
    poi-scratchpad-3.8-20120326.jar,
    ooxml-schemas-1.0.jar,
    xmlbeans-2.3.0.jar,
    dom4j-1.6.1.jar,
    geronimo-stax-api_1.0_spec-1.0.1.jar
    but then also I am getting below error-
    Exception in thread "main" org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
         at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
         at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:403)
         at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:408)
         at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:155)
         at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:183)
         at screens.LireEcrire.main(LireEcrire.java:26)
    Caused by: java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
         ... 5 more
    Caused by: org.apache.xmlbeans.XmlException: error: duplicate attribute 'o:relid'
         at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3471)
         at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1270)
         at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1257)
         at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
         at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:663)
         at org.apache.poi.xssf.usermodel.XSSFVMLDrawing.read(XSSFVMLDrawing.java:107)
         at org.apache.poi.xssf.usermodel.XSSFVMLDrawing.<init>(XSSFVMLDrawing.java:102)
         ... 10 more
    Caused by: org.xml.sax.SAXParseException: duplicate attribute 'o:relid'
         at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)
         at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
         at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3439)
         ... 16 more

    You might have better luck with a POI forum.

  • Excel Parsing -org.apache.poi.hssf.record.RecordFormatException

    Hi ,
    I am running into org.apache.poi.hssf.record.RecordFormatException,
    while creating excel work book.
    Few of the worksheets in the workbook are password protected.
    If i remove the password proted worksheets then i am able to load the
    workbook and can parse it.
    I am using apache poi 2.5.1.
    Is it possible to load workbook having few password proted sheets using apache POI?
    I appreaciate any help in this.
    Thanks in advance
    Mark
    code.
    POIFSFileSystem fs =new POIFSFileSystem(input);
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    Exception log:
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java(Compiled Code))
    at java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled Code))
    at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java(Compiled Code))
    at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java(Compiled Code))
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)
    at com.cargill.aim.examples.ExcelParseTest.main(ExcelParseTest.java:43)
    Caused by: java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62)
    at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)
    at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
    at org.apache.poi.hssf.record.Record.fillFields(Record.java(Compiled Code))
    at org.apache.poi.hssf.record.Record.<init>(Record.java(Compiled Code))
    at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
    ... 9 more
    Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance, the following exception occured: null
    at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java(Compiled Code))
    at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java(Compiled Code))
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)
    at com.cargill.aim.examples.ExcelParseTest.main(ExcelParseTest.java:43)

    Hi,
    I am dealing with the similer problem but the same error. I am using the latest version of POI 3.0.1 and trying to read the cells which have auto formating enabled for date. I am getting the same error. Please let me know if you come across any solution to read the formatted cells using POI.
    Thanks in advance!
    - Alok

  • Error While trying to Convert a Date Value to string in POI API (Excel)

    Hi
    How can I convet a date value in excel to string value ? I am using POI API for excel sheet reading in JSP .

    Hello Esther,
    the problem seems to be that the temp folder of the target Integration Builder system can't be found:
    'The system cannot find the path specified
    at [..] FileAccess.getTempDirectory([..])'.
    You'll experience the same problem if you try a file based import or export within the Integration Builder directly.
    I would recommend to continue the search there. You could check if the environment variables (for Windows: TEMP and TMP) of the OS of the system with the target Integration Builder to an existing path. Check also if the WebAs can access this path.
    Good luck
    Frank

  • Error reading excel file using POI.

    Hi ,
    I am having some problem when reading the excel file.
    While reading excel file I am getting error-java.io.IOException: Unable to read entire block; 4 bytes read; expected 512 bytes.
    part of my code:-
    InputStream stream = objFormFile.getInputStream();
    POIFSFileSystem fs = new POIFSFileSystem(stream);//getting above error here.
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    Case 1:
    I download the file on the system ,save it ,and then directly upload it to the system ,I get the above error .
    Case 2:
    It works fine if I download the excel and manually open and save it and then upload it .
    I am using JDK1.4.1 and poi-2.5.1-final-20040804.jar.
    Can any one please help me out for the above problem?
    Edited by: hruday on Jul 31, 2008 3:20 AM

    Instead of using POIFSFileSystem, try to directly create the HSSFWorkbook
    InputStream stream = objFormFile.getInputStream();
    //POIFSFileSystem fs = new POIFSFileSystem( stream );//getting above error here.
    HSSFWorkbook wb = new HSSFWorkbook( stream );

  • Formatting Error While Reading Excel File using POI 2.5 Final Related

    Hi All,
    I am using poi-2.5-final-20040302.jar for my project to create excel files.
    My system is having Microsoft Excel 2002 (SP-2) version, but my client is having Microsoft Office Excel 2003 (SP-3).
    My problem is that I can download the excel file with no formatting issues , but client is not able to download the same and is getting error as
    "Damage to the file was so extensive that repairs were not possible.Excel attempted to recover your formulas and values, but some data might have been lost or corrupted".
    After getting above error message, they can open the file but the colours,fonts ie formatting will be lost and only data will be available in excel.
    Can anyone help how to sort out ths issue.
    Thanks in Advance,
    Ravi

    Sound like the Excel file is invalid... Maybe its outdated or corrupted or something. What would we know about that? POI has a mailing list.

  • Can we create a pivot table of Excel in a JSP page using POI

    Hello,
    I want to know whether we can create a pivot table of excel sheet in a jsp page using POI package from apache.
    thank you.

    Hi Alex,
    Many thanks for replying.
    I followed the link, but unable to get correct output.. I have shared the template earlier. I can share the template once again.
    It would be grateful if you give me share the working template with table of content.

Maybe you are looking for

  • Is it possible to load and read from an Oracle global temp table?

    Is there a way to call an Oracle database package to pre-load global temp tables in BIP? I am an Oracle Reports user but a newbie to BIP. In Oracle Reports, I use the before-reports trigger to execute a database package that will populate a temp tabl

  • Word in freehand

    i have prepared a russian restaurant menu in word abd i would like to transfer it to freehand. Any idea how can i do this. I would like to be able to modify it in freehand. regards marios

  • Can i re-install firefox to fix whatever is wronb

    firefox was having trouble loading ... mostly facebook games. now wont start at all. can i just run the install program again

  • Iexplore.exe - Application error (0x0eedfade) Runtime error 217

    I have had error messages appear on my screen as I begin to shut it down. The first says: Iexplore.exe -Application error (0x0eedfade) 0x7c812a5b and the second says: Runtime error 217 at 0473F48E What do they mean? Yesterday my notebook shut down in

  • After running software update, iChat closes in error

    Hello! I just ran software update and iChat is now 4.0.5. However, the buddy list doesn't show and it does not log me into AIM. So, I opened Preferences and if I click on any tab except for Accounts, the program keeps running. But, if I click on acco