powered by Jive Software

Trouble with xpp3 and Java/Jigsaw modules

I’m trying to use Smack 4.4.0-alpha1 but this applies to older versions too.

When compiling using Java 11 (and I guess from 9 and later) I get this compilation error

Error:java: the unnamed module reads package javax.xml.namespace from both java.xml and xpp3

This is because the xpp3 JAR includes the javax.xml.namespace.QName class. Something that has been a problem since java 1.5 which included that class in the JDK. Mostly it’s been passing under the radar since the classloader has just picked one of them but with a module path this is stricter.

The XPP3 maintainer has an issue in his Jira since 2017 (https://github.com/aslom/xpp3/issues/2) but does not seem to make any progress.

I’ve tried to exclude the XPP3 and use kxml2 instead but that has other problems and is not usable with Jigsaw modules.

If anyone knows of a work-around I’d be happy because I’m sort of stuck.

Looks like it is time to start working on SMACK-591. I should probably consider scheduling this issue for Smack 4.4.

I am not sure that this is the offical home of XPP3. But anyway, I would not expect any further progress of XPP3.

1 Like

I am not sure that this is the offical home of XPP3.

I think it’s the closest you can get, Aleksander Slominski is the original author of XPP and worked together with, among others, Stefan Haustein (the kxml author) on JSR 173 - StAX (completed around 2004)

I’m not sure how easy it is to make a single Smack jar that’s compatible with both Java 9+ and Android. I’m not an Android developer but as I understand it Google didn’t include the StAX API on Android since they decided to use XmlPullParser instead. I’ve heard that historically there have been issues including the StAX API on Android (https://github.com/FasterXML/jackson-dataformat-xml/issues/142) but maybe that’s history these days. I certainly hope so.

Not sure, if it’s feasible, but there’s a similar artifact “xpp5”, which includes most classes from org.xmlpull.v1, but lacks the javax package.

However, it also lacks the MXParser class, or rather has it in another package.


But Smack could probably just use a Provider for different implementations!?

Alternatively you could try it with shade plugin, if you are using Maven:


This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.