I'm trying to test a xml to excel converter in Java and I have the following exception
Exception in thread "main" java.lang.NoSuchFieldError: Factory
at org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(XSSFWorkbook.java:475)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:232)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:226)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:214)
at xmlToExcel.Converter.initXls(Converter.java:135)
at xmlToExcel.Converter.getAndReadXml(Converter.java:60)
at xmlToExcel.Converter.main(Converter.java:36)
The exception refers to the this line:
workbook = new XSSFWorkbook();
And here are my current jars
How can I solve this? Are there any conflicts in the jars?
EDIT 1: Here is the code for the method which initialises the POI workbook and writes the header row
workbook = new XSSFWorkbook();
CellStyle style = workbook.createCellStyle();
Font boldFont = workbook.createFont();
boldFont.setBold(true);
style.setFont(boldFont);
style.setAlignment(HorizontalAlignment.CENTER);
Sheet sheet = workbook.createSheet();
rowNum = 0;
Row row = sheet.createRow(rowNum++);
Cell cell = row.createCell(SUBSTANCE_NAME_COLUMN);
cell.setCellValue("Substance name");
cell.setCellStyle(style);
The exception references the first line, the creation of the workbook.