apache / apache/maven-shade-plugin
[MSHADE-362] Exception while relocating Apache POI OOXML Schema Dependency
- Dominant language
- Java
- Stars
- 188
- Forks
- 103
- Avg merge
- 16h 39m
- Merged PRs (30d)
- 4
Description
**[Akash](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=akki1607)** opened **[MSHADE-362](https://issues.apache.org/jira/browse/MSHADE-362?redirect=false)** and commented
Trying to create a fat jar using latest version of maven shade plugin.
Relocating package of apache poi ooxml schema and xmlbeans dependency.
```java
/
org.apache.xmlbeans.
shaded.org.apache.xmlbeans.
schemaorg_apache_xmlbeans.
shaded.schemaorg_apache_xmlbeans.
org.openxmlformats.
shaded.org.openxmlformats.
/
```
Class Cast exception is coming
Caused by: java.lang.ClassCastException: shaded.org.apache.xmlbeans.impl.values.XmlComplexContentImpl cannot be cast to shaded.org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument
On analysis found that, we are reading document2bd9doctype.xsb file present in poi-ooxml-schema jar during run time and class name given in the xsb file is not getting changed during execution. Hence unable to find the correct class.
XSB file - poi-ooxml-schemas-3.12.jar!\schemaorg_apache_xmlbeans\system\sE130CAA0A01A7CDE5A2B4FEB8B311707\document2bd9doctype.xsb
Class Name in xsb file - org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument
---
**Affects:** 3.2.3
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the Maven Shade Plugin relocation with the three relocation entries shown in the issue and inspect the referenced document2bd9doctype.xsb file in poi-ooxml-schemas-3.12.jar. Trace how the class name in that XSB file is handled during relocation. Done means the relocated dependency no longer produces the reported ClassCastException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100