In my Struts2 application I'm using Displaytag 1.2 to export an Excel XLSX file, using the supplied org.displaytag.export.excel.DefaultHssfExportView
implementation.
The error I'm getting is:
Caused by: java.lang.NoSuchMethodError: 'void org.apache.poi.hssf.usermodel.HSSFCell.setCellValue(org.apache.poi.hssf.usermodel.HSSFRichTextString)'
at org.displaytag.render.HssfTableWriter.writeHeaderFooter(HssfTableWriter.java:324)
at org.displaytag.render.HssfTableWriter.writeTableHeader(HssfTableWriter.java:151)
at org.displaytag.render.TableWriterTemplate.writeTable(TableWriterTemplate.java:125)
at org.displaytag.export.excel.DefaultHssfExportView.doExport(DefaultHssfExportView.java:49)
It's some kind of library conflict on setCellValue(HSSFRichTextString)
. The details are:
displaytag.properties (note we're exporting Excel)
export.xml=false
export.excel=true
export.excel.class=org.displaytag.export.excel.DefaultHssfExportView
export.csv=false
export.pdf=false
export.excel.filename=ets.xls
export.decorated=false
export.banner=<div id="export_banner"><b><i>Export options:</i></b> {0}</div>
export.banner.placement=both
Library List in Java App
Related to Displaytag
displaytag-1.2.jar
displaytag-export-poi-1.2.jar
poi-3.16.jar
sfl4j-api-1.7.12.jar
sfl4j-nop-1.6.1.jar
Struts, Spring, Commons, etc.
commons-io-2.2.jar
commons-lang-2.4.jar
commons-lang3-3.2.jar
commons-logging-1.1.3.jar
commons-logging-api-1.1.jar
log4j-1.2.9.jar
org.springframework.aop-3.0.5.RELEASE.jar (+ asm, aspects, beans, context, core, web, web.struts)
struts2-core-2.3.37.jar (+ dojo, jquery, spring-plugin, tiles-plugin)
velocity-1.6.4.jar
tiles-api-2.2.2.jar (+ core, el, jsp, ognl, servlet)
The solution to this problem is to use POI 3.2 (file: poi-3.2-FINAL.jar). I was using 3.16, and had to downgrade.
Here's another thread on having to use this specific old POI version: https://stackoverflow.com/a/23538224/1005607