Skip to content
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

Stax 4.0.0 is not compatible with Woodstox 5.0.1 #10

Closed
naveengopi opened this issue Dec 10, 2015 · 7 comments
Closed

Stax 4.0.0 is not compatible with Woodstox 5.0.1 #10

naveengopi opened this issue Dec 10, 2015 · 7 comments
Milestone

Comments

@naveengopi
Copy link

While upgrading to the latest version of Stax and Woodstox we encountered NoSuchMethodError. The stacktrace is as follows.

Caused by: java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;
at com.ctc.wstx.util.DataUtil.emptyIterator(DataUtil.java:74)

Moving back to stax 3.1.4 version has fixed this issue for issue for us, but would like to see this error fixed. Is it already a known issue?

@cowtowncoder
Copy link
Member

@naveengopi Not yet a known issue. I'll have to go back and see what gives. However, I think that Woodstox 5.0.1 actually specifies 3.1.4 dependency of stax2-api, and that is the version you should be using. But I'll see how this can be resolved; does not seem like this incompatibility is intentional.

@cowtowncoder
Copy link
Member

Ok, I think I know what is causing this: although 3.1.4 and 4.0.0 are source-code compatible -- that is, you can compile Woodstox 5.0 against either one -- they are, unfortunately, exactly binary-compatible with respect to method getInstance() of EmptyIterator. Difference is small but meaningful: return type in 3.1 is EmptyIterator, whereas 4.0 has type as Iterator. As a result, method signatures are actually different.

As to how to fix that... this gets bit tricky. While I could change stax-api2 to use old signature, that would then make 4.0.0 and 4.0.1 slightly incompatible. I can recompile Woodstox 5.0.0 against newer version, which is bit better, although that will then not work with 3.x versions.

The best way may actually be to avoid use of this version of EmptyIterator completely, and use a local helper class. This gives most backwards compatibility.

Thank you for reporting this -- it is an unfortunate, unintended incompatibility. But at least we can address it to some degree.

@cowtowncoder cowtowncoder added this to the 5.0.2 milestone Dec 10, 2015
@cowtowncoder
Copy link
Member

Releasing 5.0.2 patch now. 5.1 will use stax-api2 v4.0.

@naveengopi
Copy link
Author

Will you be also updating the release notes or the README file as an announcement of the new version?

@cowtowncoder
Copy link
Member

Sure, thanks.

@naveengopi
Copy link
Author

Thanks for updating the info. Maybe you also need to update the Notes section as well

@cowtowncoder
Copy link
Member

Not sure where else it would make sense -- reference to 5.0.1 below is still valid

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

2 participants