I am trying to read data from .XLSX file using Latest Apache POI libraries 4.0.1. However I amgetting follwoing error when I am trying to getCellType() or cell.getStringCellValue() etc.
However it could read wb.getPhysicalNumberOfRows() , row.getCell(x) properly without error.
error - NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList
Steps followed -
InputStream ExcelFileToRead = new FileInputStream("D:\\Test.xlsx");
XSSFWorkbook wb = new XSSFWorkbook(ExcelFileToRead);
XSSFWorkbook test = new XSSFWorkbook();
XSSFSheet sheet = wb.getSheetAt(0);
Iterator rows = sheet.rowIterator();
Iterator cells = row.cellIterator();
if (cell.getCellType() == XSSFCell.CELL_TYPE_STRING)
else if(cell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC)
Please let me know how to resolve this error.
You are probably missing the ooxml-schemas-1.4.jar file. See item 3 on the following FAQ page for details:
Please add ooxml-schemas-1.3.jar to sopaui_home/bin/ext, restart and try again.
Don't forget to accept as solution and give kudos.
I tried by adding ooxml-schemas-1.4.jar file into ext folder but getting same error -
PFA: screenshot of ext folder jars.
even with ooxml-schemas-1.3.jar added to ext folder giving same error.
Can u please chk the screenshot provided and suggest if any jar missing or need to remove?
Please download POI-3.14 or POI 3.16 and ooxml-schemas-1.3.jar and put inside ext folder.
Please have a look at solution, I have provided and it worked:-
@mkajale2, you stated that you are using POI 4.0.1 in your original question, according to the Apache POI FAQ:
You should be using ooxml-schemas-1.4.jar
Please review item 3 of the apache POI FAQ linked above, the title of item 3 is:
"I'm using the poi-ooxml-schemas jar, but my code is failing with "java.lang.NoClassDefFoundError: org/openxmlformats/schemas/*something*""
Which matches the error in you original post.
As mentioned in earlier post I have used ooxml-schemas-1.4.jar but was getting same error.
Please refer screenshot of the ext folder contains jar files.
I have latest POI 4.0.1 and ooxml-schemas-1.4.jar so want the solution based on that.
If we have any known technical limitation then I will try out with POI-3.14 or POI 3.16 and ooxml-schemas-1.3.jar as suggested by you.
Plz share if u have faced issue with latest one.
Sorry, I missed your original reply, To be honest I'm not sure what to suggest next? I will mention the obvious, are you restarting Ready API after altering the contents of the ext directory?
The one thing that I'm not 100% sure of is whether the ooxml-schemas-1.4.jar file replaces poi-ooxml-schemas4.0.1.jar or sits along side it? The Apache FAQ uses the rather ambiguous text (my emphasis):
"Every so often, you may try to use part of the file format which isn't included in the minimal poi-ooxml-schemas jar. In this case, you should switch to the full ooxml-schemas-1.4.jar."
Does switch mean replace??? Perhaps try removing the file poi-ooxml-schemas4.0.1.jar but this is just a guess.