DATA CENTER AND SERVER | CLOUD
Word Export Error 500 NoClassDefFoundError of class ZipPackagePropertiesMarshaller
Problem
Word export starts throwing error 500 after upgrading Jira and/or R4J version.
Stack traces:
java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller
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:161) [?:?]
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141) [?:?]
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:97) [?:?]
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324) [?:?]
java.lang.ExceptionInInitializerError
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161) [?:?]
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141) [?:?]
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:97) [?:?]
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324) [?:?]
Caused by: java.lang.ClassCastException: org.apache.xerces.stax.XMLEventFactoryImpl cannot be cast to javax.xml.stream.XMLEventFactory
at javax.xml.stream.XMLEventFactory.newInstance(XMLEventFactory.java:30) [?:1.8.0_275]
at org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:41) [?:?]
Cause
The problem occurs intermittently and may be caused by conflicting dependencies installed in a Jira instance.
R4J uses Apache POI 3.16, a version which may have xerces build issues related to the error stacks encountered.
Solution
To resolve this error, upgrade to R4J version 4.4.2 or higher.
Newer versions of Apache POI, starting from version 4.0.1, have fixed old xerces build issues. The dependency upgrade implemented since R4J version 4.4.2 is necessary to resolve the issue.