I'm having some problems including Apache Poi in a simple Jira plugin. While trying to make a simple proof of concept to generate an Excel file (ooxml actually) I'm getting some dependency / class cast exception issues. My plugin extends AbstractSearchRequestView and the following code snippets tries to output an empty xlsx file.
public void writeSearchResults(SearchRequest sr, SearchRequestParams srp, Writer writer) throws SearchException
{
XSSFWorkbook wb = new XSSFWorkbook();
WriterOutputStream out = new WriterOutputStream(writer);
wb.write(out);
}
Now I have my export option available in the Jira issue search screen, but when running it I'm getting the following classcastexception:
java.lang.ClassCastException: com.ctc.wstx.stax.WstxEventFactory cannot be cast to javax.xml.stream.XMLEventFactory
My pom file POI dependencies look like this:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
I have tried to configure everything like in this question / answer but I get the same issue.