I need to export some data to Excel from a small Grails application. To do so, I have added the following dependencies to my BuildConfig:
dependencies {
compile 'org.apache.poi:poi-ooxml:3.13'
compile 'org.apache.poi:poi-ooxml-schemas:3.13'
}
Whenever I try to utilize the libraries, I run into a ClassNotFoundException. The following code reproduces to error:
Workbook workbook = new XSSFWorkbook()
Sheet sheet = workbook.createSheet("Title")
Row row = sheet.createRow(0)
// Make first header row:
row.createCell(0).setCellValue("Header1")
The call to row.createCell(0).setCellValue("Header1")
Produces the following stacktrace-message:
Class
java.lang.ClassNotFoundException
Message
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExtensionList
Originally I only included the poi-ooxml
but a jar-finder search suggests that the class is included in poi-ooxml-schemas
, so I included that as well. It still doesn't work however. The code compiles fine and the error occurs runtime.
Any suggestions? Am I missing something or what?