Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Export to XLS from custom add-on

ArtemT April 17, 2017

Hello all.

I am developing plugin for JIRA and want to make some data export from it to Excel file. I'm trying to use Apache POI library, but I get the following error:

java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller
 at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:162)
 at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:142)
 at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:37)
 at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:65)
 at org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:338)
 at org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:434)
 at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:218)
...

The error occures on the following code line:

XSSFWorkbook workbook = new XSSFWorkbook();

And here are my dependencies:

<dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <version>${ao.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.9</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>3.9</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>2.6.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>2.0.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.11.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.9</version>
            <exclusions>
                <exclusion>
                    <groupId>stax</groupId>
                    <artifactId>stax-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Should I add something to the atlassian-plugin.xml?

Does anyone know what is the problem?

1 answer

0 votes
Aron Gombas _Midori_
Community Champion
April 18, 2017

You may want to check out if the Excel API provided by the Better Excel Plugin meets your use case.

If it does, it will save you many weeks of efforts, not to mention long-time maintenance work.

Suggest an answer

Log in or Sign up to answer