Skip to content

NoSuchMethodError after update to Woodstox 5.1.0 #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
veita opened this issue Apr 3, 2018 · 11 comments
Closed

NoSuchMethodError after update to Woodstox 5.1.0 #46

veita opened this issue Apr 3, 2018 · 11 comments
Milestone

Comments

@veita
Copy link

veita commented Apr 3, 2018

Woodstox 5.1.0 introduces JAR conflicts due to linkage with newer StAX library. It seems that 5.1.0 cannot be used together with libraries that are dependent on stax2-api 3.1.4 (e.g. Apache Olingo).

This behaviour seems to violate the semantic versioning rules.

java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Ljava/util/Iterator;
	at com.ctc.wstx.util.DataUtil.emptyIterator(DataUtil.java:46)
	at com.ctc.wstx.evt.SimpleStartElement.getAttributes(SimpleStartElement.java:111)
	at org.odftoolkit.odfdom.pkg.rdfa.RDFaParser.getAttributeByName(RDFaParser.java:414)
	at org.odftoolkit.odfdom.pkg.rdfa.RDFaParser.parse(RDFaParser.java:190)
	at org.odftoolkit.odfdom.pkg.rdfa.RDFaParser.beginRDFaElement(RDFaParser.java:114)
	at org.odftoolkit.odfdom.pkg.rdfa.SAXRDFaParser.startElement(SAXRDFaParser.java:115)
	at org.odftoolkit.odfdom.pkg.rdfa.MultiContentHandler.startElement(MultiContentHandler.java:83)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.odftoolkit.odfdom.pkg.OdfFileDom.initialize(OdfFileDom.java:223)
	at org.odftoolkit.odfdom.dom.OdfContentDom.initialize(OdfContentDom.java:60)
	at org.odftoolkit.odfdom.pkg.OdfFileDom.<init>(OdfFileDom.java:105)
	at org.odftoolkit.odfdom.dom.OdfContentDom.<init>(OdfContentDom.java:50)
	at org.odftoolkit.odfdom.pkg.OdfFileDom.newFileDom(OdfFileDom.java:157)
	at org.odftoolkit.odfdom.pkg.OdfPackageDocument.getFileDom(OdfPackageDocument.java:323)
	at org.odftoolkit.odfdom.dom.OdfSchemaDocument.getFileDom(OdfSchemaDocument.java:405)
	at org.odftoolkit.odfdom.dom.OdfSchemaDocument.getContentDom(OdfSchemaDocument.java:206)
	at org.odftoolkit.simple.chart.AbstractChartContainer.<init>(AbstractChartContainer.java:71)
	at org.odftoolkit.simple.TextDocument$ChartContainerImpl.<init>(TextDocument.java:957)
	at org.odftoolkit.simple.TextDocument.getChartContainerImpl(TextDocument.java:948)
	at org.odftoolkit.simple.TextDocument.getChartByTitle(TextDocument.java:853)

Reason is the different return type of EmptyIterator.getInstance().

@cowtowncoder
Copy link
Member

I don't think it violates rules of SemVer: minor versions can introduce new functionality. And in case of stax2-api, there is also non-patch version bump. But it does look like an interoperability problem, regardless of classification.
So I would suggest updating stax2-api dependency to 4.0 and see if things work; the reason for major version bump there is just because JDK 6 is required over JDK 5.
Otherwise API is backwards compatible, with relatively minor additions.

Having said that, I could consider changing Woodstox to call deprecated method to improve inter-operability, with 5.1.1. Ability to work on earlier version would be a good thing, given that stax2 api itself has not significantly changed.

@cowtowncoder
Copy link
Member

Ahhh. Now I can see the problem wrt binary compatibility. That is... unfortunate.
I should have known better than changing return type in source-compatible, but binary-INcompatible way.

I think I will resolve this for Woodstox 5.2 by embedding helper class and avoiding dependency.
I don't think there is other easy solution, unfortunately

@tkvangorder
Copy link

@cowtowncoder I recently ran into this issue upgrading a large Spring Boot application to Java 11. In our case:

image

Is it safe for me to just exclude the stax2-api 4.1 from jaxws to force things back to 3.1.4?

@tkvangorder
Copy link

tkvangorder commented May 21, 2020

Actually looking at that, it appears I will have both woodstox-core-asl 4.4.1 and woodstox-core 5.0.3 in my dependencies....ugh. Just looking for some guidance on the best way to set this up.

I am thinking maybe the safest thing to do is to exclude the older stax2-api and woodstox-core-asl from the solrj dependency?

@cowtowncoder
Copy link
Member

Yeah the problem here is that due to name change, woodstox-core-asl and woodstox-core are not recognized by Maven as the same thing (technically they are not).
So you will need to decided whether to try to force older (woodstox-core-asl) or newer (woodstox-core) to be used, and then match stax2-api to use, one that is compatible with your choice.
Given that Woodstox itself is actually quite API compatible, I would probably first try newer version (woodstox-core, 5.3.0, stax2-api 4.2.1); and if that does not work, then older combination.

@tkvangorder
Copy link

Thanks, I have gone with the newer version of woodstox-core and stax2-api. So far, so good!

@cowtowncoder
Copy link
Member

@tkvangorder Ok good luck!

@leenabhandari
Copy link

leenabhandari commented Aug 25, 2021

I added this and it started working for me.

<dependency>
  <groupId>com.fasterxml.woodstox</groupId>
  <artifactId>woodstox-core</artifactId>
  <version>6.1.1</version>
</dependency>

@JonasFreireAlcantara
Copy link

JonasFreireAlcantara commented Aug 26, 2021

I added this and it started working for me.

<dependency>
  <groupId>com.fasterxml.woodstox</groupId>
  <artifactId>woodstox-core</artifactId>
  <version>6.1.1</version>
</dependency>

Leena thank you so much, you have no idea of how much you helped me, thanks, thanks, thanks
😍

God bless you!

@vignesh-ragavan
Copy link

Actually looking at that, it appears I will have both woodstox-core-asl 4.4.1 and woodstox-core 5.0.3 in my dependencies....ugh. Just looking for some guidance on the best way to set this up.

I am thinking maybe the safest thing to do is to exclude the older stax2-api and woodstox-core-asl from the solrj dependency?
Can u send which one u excluded?

@cowtowncoder
Copy link
Member

Exclude older version (woodstox-core-asl), and if you have multiple stax2-apis, older one (but you shouldn't -- artifact name did not change unlike with Woodstox itself).

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

No branches or pull requests

6 participants