Woodstox stax2 conflict fix - #633
Merged
Merged
Conversation
…aks StAX
The ds3-sdk -all (shadow) jar shipped a Woodstox that could not run against
the stax2-api packaged beside it, so any use of the StAX *event* API threw:
NoSuchMethodError: 'ds3fatjar.org.codehaus.stax2.ri.EmptyIterator
ds3fatjar...EmptyIterator.getInstance()'
Cause: ds3-sdk declared org.codehaus.woodstox:woodstox-core-asl:4.4.1 while
jackson-dataformat-xml already brings com.fasterxml.woodstox:woodstox-core.
Both publish classes in com.ctc.wstx.*, so two Woodstox generations were on
the classpath. shadowJar merged them and the ASL 4.4.1 classes won, but
stax2-api resolved UP to 4.2.1 because the fasterxml woodstox requires it.
ASL 4.4.1 is compiled against stax2-api 3.x, where
EmptyIterator.getInstance() returns EmptyIterator; in 4.2.1 it returns
Iterator<T>. Method resolution matches on the full descriptor including
return type, so the call site could not be resolved.
Eight shaded Woodstox classes carried that stale expectation
(CompactStartElement, SimpleStartElement, BaseStartElement, MergedNsContext,
CompactNsContext, InputElementStack, OutputElementBase,
EmptyNamespaceContext).
Jackson uses the StAX *streaming* API, so the SDK's own tests never touched
the broken method and the jar looked healthy. The AWS SDK's XmlDomParser
uses the *event* API, and because the -all jar also registers its relocated
Woodstox under the standard META-INF/services/javax.xml.stream.* keys it
becomes the JVM-wide StAX provider for anything on the same classpath. In
BlackPearl that broke S3 target registration outright: DataPlanner's
registerS3Target -> S3 connect -> parse response -> NoSuchMethodError -> 500.
ds3-sdk 5.4.1 was unaffected because it paired Woodstox 5.0.3 with a matching
stax2-api 3.1.4.
Dropping the redundant ASL dependency leaves Jackson's woodstox-core 6.5.0
with its matching stax2-api 4.2.1.
Verified on the rebuilt -all jar:
- StAX event API (StartElement.getAttributes) now works
- DS3 XML read semantics unchanged: an absent element and a self-closing
<ReadFromPoolId/> both still deserialize to null, and an empty-text
element still yields the nil UUID -- byte-identical to the old jar
- DS3 XML writing unchanged: <Objects><Object Name="my_object"/></Objects>
- ds3-sdk unit tests: 320 run, 0 failures, 0 errors
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Asha Pillai <asha.pillai@spectralogic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ds3-sdk -all (shadow) jar shipped a Woodstox that could not run against the stax2-api packaged beside it, so any use of the StAX event API threw:
NoSuchMethodError: 'ds3fatjar.org.codehaus.stax2.ri.EmptyIterator
ds3fatjar...EmptyIterator.getInstance()'
Cause: ds3-sdk declared org.codehaus.woodstox:woodstox-core-asl:4.4.1 while jackson-dataformat-xml already brings com.fasterxml.woodstox:woodstox-core. Both publish classes in com.ctc.wstx.*, so two Woodstox generations were on the classpath. shadowJar merged them and the ASL 4.4.1 classes won, but stax2-api resolved UP to 4.2.1 because the fasterxml woodstox requires it. ASL 4.4.1 is compiled against stax2-api 3.x, where EmptyIterator.getInstance() returns EmptyIterator; in 4.2.1 it returns Iterator. Method resolution matches on the full descriptor including return type, so the call site could not be resolved.
Eight shaded Woodstox classes carried that stale expectation (CompactStartElement, SimpleStartElement, BaseStartElement, MergedNsContext, CompactNsContext, InputElementStack, OutputElementBase, EmptyNamespaceContext).