Hey everyone,
I’m trying to make Apache POI 5.2.0 run with Jira 9.11.2, but I keep running into a ClassCastException error involving DocumentBuilderFactory. I have all the required dependencies set in my pom.xml, including log4j, SparseBitSet, and the different POI libraries. I’ve also added the Jira API dependency and configured the maven-shade-plugin as recommended, yet I still face issues.
The error message I receive is:
java.lang.ClassCastException: class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to class javax.xml.parsers.DocumentBuilderFactory
Does anyone have guidance on what additional changes might be needed in the pom.xml or how to adjust the maven-shade-plugin configuration to resolve this conflict? Any suggestions or solutions would be greatly appreciated. Thanks in advance!
The ClassCastException you’re experiencing may be due to conflicting XML parser implementations in your environment. From personal experience, excluding xerces from the POI dependencies and using the XML APIs provided with the JDK has often resolved similar issues. It is also important to review your ClassLoader configuration to ensure it does not interfere with core Java classes, and employing the maven-enforcer-plugin can help detect hidden dependency conflicts. If these measures do not work, consider reverting to a POI version that is known to integrate smoothly with Jira, and double-check the maven-shade-plugin settings to ensure proper handling of XML parser classes.
I encountered a similar issue when integrating Apache POI with Jira. In my experience, the ClassCastException was caused by conflicting XML parser implementations. I resolved the problem by excluding xerces from my POI dependencies and ensuring that the XML APIs in use were those bundled with the JDK. I also verified that my custom ClassLoader was not interfering with core Java classes. In addition, I employed the maven-enforcer-plugin to identify any dependency conflicts. If these measures do not resolve the issue, you might consider trying an older version of POI that is known to be compatible with Jira.
hey there! i’ve run into similar issues before. have u tried excluding xerces from ur dependencies? sometimes it conflicts with the version bundled in jira. also, check if ur using the right version of xml-apis. might wanna try updating to the latest compatible version. good luck!