users@jaxb.java.net

Get "Provider xx not a subtype" when adding JAXB extension to XJC

From: KARR, DAVID <dk068x_at_att.com>
Date: Tue, 20 Jan 2015 16:34:34 +0000

This is a variation of a question I asked last week, which I didn't get any response to.

I can run XJC on a particular XSD and successfully generate classes. If I add to the classpath either of two particular JAXB extensions I'm trying to use, it fails with a stacktrace like the following:
-----------------
Exception in thread "main" java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: Provider dk.conspicio.jaxb.plugins.XmlElementWrapperPlugin not a subtype
        at java.util.ServiceLoader.fail(ServiceLoader.java:231)
        at java.util.ServiceLoader.access$300(ServiceLoader.java:181)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:369)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
        at com.sun.tools.xjc.Options.findServices(Options.java:924)
-----------------

I'm currently using a local copy of the "ElementWrapper" plugin and a reference to the "fluent API" plugin. If I remove the reference to the "ElementWrapper" plugin from the classpath, this error refers to the "fluent API" plugin.

I'm adding references to the following jars in the classpath:
* jaxb-xjc
* jaxb-impl
* jaxb-api
* element wrapper jar
* fluent api jar
* activation-1.1.1.jar
* jsr173 jar

I'm currently using version 2.2.6 of the jaxb jars.

I've tested this sequence in a shell script, just calling XJCFacade directly. I've tested this in an Ant build script, using the Ant XJC task. I've tested this in Gradle, using the same Ant XJC task. All of these fail with the same result.

However, I've also tested this in Maven, using the "cxf-xjc-plugin" Maven plugin. This is working, processing the same schema and adding the same extensions. This has actually been working like this for quite a while, but I'm trying to convert this application build from Maven to Gradle. This obstacle is preventing this.