Ask a Question

RAW_XML_FILE_HEADER

SOLVED
alfonsolftc
Occasional Contributor

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? 

7 REPLIES 7
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 

Error.PNG

 

 

 

 

 

 

 

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

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
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?

Hi @alfonsolftc 

 

 

nah - this error response is pretty clear about what the problem is.  also - your ReadyAPI! version shouldnt have any impact - your java runtime may be an issue (version of JDK/JRE) but not ReadyAPI!

 

as I mention before - it's when it finds a class at compile time but on runtime the class is missing -either you're not using the correct import dec or the associated .jar file is non-existent, incorrectly named (unlikely) or it's in the wrong directory.

 

without sitting in front of your laptop - im almost 100% thats the problem

 

on a side note - is there a reason you're trying to use groovy to source your data from a spreadsheet rather than use the Data driven functionality available within ReadyAPI!?

 

if you cant use the data driven functionality - looking at your script - it just appears to find the spreadsheet, iterate through each cell and grab a single value?  is that correct?  it might be easier to source the value from a .txt file or .csv and then you don't have to bother trying to import all these additional classes for handling a spreadsheet?

 

the soapui help link might give you an easier way forward

 

nice one!

 

rich

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
TanyaYatskovska
SmartBear Alumni (Retired)

Thanks for the suggestions, richie.

 

@alfonsolftc, were you able to identify the cause of the error? Please let us know if you still need assistance.

 

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



Hi

 

The problem was resolved when  I installed the version 3.0

 

Thanks

TanyaYatskovska
SmartBear Alumni (Retired)

Great to hear the issue is resolved 🙂

 

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: