Skip to content

Woodstox stax2 conflict fix - #633

Merged
ashap-spectra merged 2 commits into
masterfrom
woodstox_stax2_conflict_fix
Aug 26, 2026
Merged

Woodstox stax2 conflict fix#633
ashap-spectra merged 2 commits into
masterfrom
woodstox_stax2_conflict_fix

Conversation

@ashap-spectra

Copy link
Copy Markdown
Contributor

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).

ashap-spectra and others added 2 commits August 25, 2026 15:32
…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>

@scribe scribe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@ashap-spectra
ashap-spectra merged commit 9a2df82 into master Aug 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants