Forum Discussion

alfonsolftc's avatar
alfonsolftc
Occasional Contributor
6 years ago

RAW_XML_FILE_HEADER

Hi, 


I´m executing  the folowing groovy script

import java.io.*
import java.lang.*
import java.util.*
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
import org.apache.poi.ss.util.*;

 

def fs = new FileInputStream ("D:\\Parametros1.xlsx");
Workbook wb = WorkbookFactory.create(fs);

 

I d'ont undertand the following error RAW_XML_FILE_HEADER in line

 Workbook wb = WorkbookFactory.create(fs);

 

Could you lend me a hand? 

  • alfonsolftc's avatar
    alfonsolftc
    6 years ago

    Hi

     

    The problem was resolved when  I installed the version 3.0

     

    Thanks

  • alfonsolftc's avatar
    alfonsolftc
    Occasional Contributor

     

    I´ve seen that soap-ui v 5.2.1 works good.In Ready API-2.8.0 does not work.

     

    I attach the error 

     

     

     

     

     

     

     

    • richie's avatar
      richie
      Community Hero

      Hey alfonsolftc 

       

      is this separate to your initial problem you found relating to RAW_XML_FILE_HEADER or is this the same?

       

      If you post the whole groovy script you're using that'll probably add a littel context for people reviewing your post.

       

      I can't comment on the difference between open source SoapUI and ReadyAPI! but your import declarations don't include an import dec for org.apache.poi.poifs.... should it?

       

      if you see the stackoverflow link is mentions NoClassDefFoundError is due to a class being found at compilation time, but isn't at runtime so I'd double check whatever you're importing actually exists - i.e. you have the correct .jar file added correctly

       

      cheers,

       

      rich

      • alfonsolftc's avatar
        alfonsolftc
        Occasional Contributor

        It´s the same problem, the firts time that I executed the script show me RAW_XML_FILE_HEADER error, but the followings times, show me:

         

        "java.langNoClassDefFoundError:Could not initialize class org.apache.poi.poifs.filesystem.Magic error at line 14"

        import java.io.File;
        import java.io.FileInputStream;
        import java.util.Iterator;
        import org.apache.poi.ss.usermodel.Cell;
        import org.apache.poi.ss.usermodel.Row;
        import org.apache.poi.ss.usermodel.Sheet;
        import org.apache.poi.ss.usermodel.Workbook;
        import org.apache.poi.ss.usermodel.WorkbookFactory;

         

        String filepath = "D:\\prueba_estila\\Parametros1.xlsx"
        String sheetName = "Sheet1"
        FileInputStream fis = new FileInputStream(new File(filepath))

         

        Workbook wb = WorkbookFactory.create(fis)
        Sheet sh = wb.getSheet(sheetName)

        Iterator itrRow = sh.rowIterator()
        while(itrRow.hasNext())
        {
            Row row = itrRow.next()
            for(Cell cell : row)
            {
                switch(cell.getCellType())
                {
                    case Cell.CELL_TYPE_NUMERIC:
                        log.info cell.getNumericCellValue()
                        break;
                    default:
                        log.info cell.getRichStringCellValue()
                }      
            }  
        }

        fis.close()
        wb.close()

         

        In Ready API 2.8.0 show me the error but in SOAPUI 5.2.1 does not show error

         

        I´ve put the flowing libraries in ReadyAPI 2.8.0

        poi-4.1.1.jar

        poi-excelant-4.1.1.jar

        poi-ooxml-4.1.1.jar

        poi-ooxml-schemas-4.1.1.jar

        poi-scratchpad-4.1.1.jar

         

        Could be any library incompatible with READY APi2.8.0?