wildfly-client-all incorrectly including geronimo spec classes?

192 views
Skip to first unread message

Josh Fisher

unread,
Feb 22, 2021, 8:12:53 PM2/22/21
to WildFly
I have been upgrading from WildFly 20.0.1.Final to 22.0.1.Final and encountered an issue in a standalone client that imports wildfly-client-all.jar and uses javax.json APIs backed by the org.glassfish:jakarta.json:1.1.6 implementation.

I was getting this error and a related ClassNotFoundException when using a javax.json API in my client:

javax.json.JsonException: org.apache.johnzon.core.JsonProviderImpl not found
    at javax.json.spi.JsonProvider.doLoadProvider(JsonProvider.java:132)
    at javax.json.spi.JsonProvider.provider(JsonProvider.java:64)

I did some investigating and it seems that the javax.json.spi.JsonProvider class in wildfly-client-all.jar is not coming from the org.glassfish:jakarta.json artifact, where it would reference org.glassfish.json.JsonProviderImpl as the default/fallback implementation, as it did prior to 22 though it is still including this artifact. Instead, it looks like this is coming from the org.apache.geronimo.specs:geronimo-json_1.0_spec, which I think is somehow getting in through one of the org.apache.actimemq:* dependencies, although I believe those exclude geronimo and johnzon, or at least I believe the JMS BOM is configured to.

This can be worked around by declaring a proper javax.json.spi.JsonProvider SPI implementation, but I thought it would be worth sharing since it was kind of hard to track down. I should note I have NOT checked the JMS BOM with Maven at the time of writing this, so as far as I know it is only an issue with wildfly-client-all.jar.


Josh Fisher

unread,
Feb 23, 2021, 3:59:45 PM2/23/21
to WildFly
I should note that explicitly declaring a javax.json.spi.JsonProvider SPI implementation may not be enough, because once I started using the app I noticed certain things with javax.json were not working due to the Geronimo JAR being API incompatible, such as JsonArray#asValues(Function), which Glassfish and javax.json API have but Geronimo does not apparently.

James Perkins

unread,
Feb 23, 2021, 5:41:57 PM2/23/21
to WildFly
That looks like something else must be leaking in that dependency. It's definitely not in the wildfly-client-all.jar. The dependencies are definitely the Jakarta API and Glassfish implementation https://github.com/wildfly/wildfly/blob/31dca19a0474457c592e4cbbcb8df6c7f5f9dce1/client/shade/pom.xml#L216-L225.

I checked the JAR too and the API and implementation are definitely there.

jperkins@stalefish ~ $ jar tvf ~/.m2/repository/org/wildfly/wildfly-client-all/22.0.1.Final/wildfly-client-all-22.0.1.Final.jar | grep json
     0 Thu Feb 11 08:33:20 PST 2021 org/wildfly/security/json/
     0 Thu Feb 11 08:33:20 PST 2021 org/wildfly/security/json/util/
  3817 Thu Feb 11 08:33:20 PST 2021 org/wildfly/security/json/util/JsonUtil.class
     0 Thu Feb 11 08:33:20 PST 2021 META-INF/maven/org.wildfly.security/wildfly-elytron-json-util/
  1794 Tue Jan 05 12:55:38 PST 2021 META-INF/maven/org.wildfly.security/wildfly-elytron-json-util/pom.xml
   118 Tue Jan 05 13:00:00 PST 2021 META-INF/maven/org.wildfly.security/wildfly-elytron-json-util/pom.properties
     0 Thu Feb 11 08:33:20 PST 2021 io/netty/handler/codec/json/
  4499 Thu Feb 11 08:33:20 PST 2021 io/netty/handler/codec/json/JsonObjectDecoder.class
   375 Thu Jul 09 12:32:56 PDT 2020 META-INF/native-image/io.netty/transport/reflection-config.json
     0 Thu Feb 11 08:33:20 PST 2021 META-INF/maven/org.apache.geronimo.specs/geronimo-json_1.0_spec/
   163 Wed Sep 17 21:19:34 PDT 2014 META-INF/maven/org.apache.geronimo.specs/geronimo-json_1.0_spec/pom.properties
  4247 Wed Sep 17 21:19:30 PDT 2014 META-INF/maven/org.apache.geronimo.specs/geronimo-json_1.0_spec/pom.xml
     0 Thu Feb 11 08:33:20 PST 2021 javax/json/
  3110 Thu Feb 11 08:33:20 PST 2021 javax/json/Json.class
   819 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonArray.class
   792 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonArrayBuilder.class
   362 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonBuilderFactory.class
   534 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonException.class
   534 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonNumber.class
   864 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonObject.class
  1004 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonObjectBuilder.class
   301 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonReader.class
   439 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonReaderFactory.class
   297 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonString.class
   146 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonStructure.class
  1076 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonValue$1.class
  1135 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonValue$2.class
  1136 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonValue$3.class
  1324 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonValue$ValueType.class
   651 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonValue.class
   307 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonWriter.class
   441 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonWriterFactory.class
     0 Thu Feb 11 08:33:20 PST 2021 javax/json/spi/
   765 Thu Feb 11 08:33:20 PST 2021 javax/json/spi/JsonProvider$1.class
  6079 Thu Feb 11 08:33:20 PST 2021 javax/json/spi/JsonProvider.class
     0 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/
   576 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/JsonGenerationException.class
  1554 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/JsonGenerator.class
   487 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/JsonGeneratorFactory.class
   205 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/JsonLocation.class
  1557 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/JsonParser$Event.class
   552 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/JsonParser.class
   598 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/JsonParserFactory.class
   914 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/JsonParsingException.class
     0 Thu Feb 11 08:33:20 PST 2021 META-INF/maven/org.glassfish/jakarta.json/
   134 Tue Aug 20 06:29:32 PDT 2019 META-INF/maven/org.glassfish/jakarta.json/pom.properties
 11309 Tue Aug 20 06:22:42 PDT 2019 META-INF/maven/org.glassfish/jakarta.json/pom.xml
  3384 Thu Feb 11 08:33:20 PST 2021 javax/json/EmptyArray.class
  2887 Thu Feb 11 08:33:20 PST 2021 javax/json/EmptyObject.class
   234 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonMergePatch.class
  2105 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonPatch$Operation.class
   373 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonPatch.class
   635 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonPatchBuilder.class
   569 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonPointer.class
  1141 Thu Feb 11 08:33:20 PST 2021 javax/json/JsonValueImpl.class
  8749 Thu Feb 11 08:33:20 PST 2021 javax/json/stream/JsonCollectors.class
     0 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/
  1452 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/BufferPoolImpl.class
  4429 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonArrayBuilderImpl$JsonArrayImpl.class
  9693 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonArrayBuilderImpl.class
  2399 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonBuilderFactoryImpl.class
  2090 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonGeneratorFactoryImpl.class
  1004 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonGeneratorImpl$1.class
   662 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonGeneratorImpl$Context.class
  1274 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonGeneratorImpl$Scope.class
 15558 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonGeneratorImpl.class
  1263 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonLocationImpl.class
  3620 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonMergePatchImpl.class
  9168 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonMessages.class
   747 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonNumberImpl$JsonBigDecimalNumber.class
  1507 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonNumberImpl$JsonIntNumber.class
  1556 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonNumberImpl$JsonLongNumber.class
  2993 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonNumberImpl.class
  4811 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonObjectBuilderImpl$JsonObjectImpl.class
  7290 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonObjectBuilderImpl.class
  2090 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserFactoryImpl.class
  1804 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl$1.class
  2611 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl$2.class
  1731 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl$3.class
  1719 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl$4.class
  3607 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl$ArrayContext.class
   965 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl$Context.class
  2754 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl$NoneContext.class
  3838 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl$ObjectContext.class
  1817 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl$Stack.class
 11084 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonParserImpl.class
  4643 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonPatchBuilderImpl.class
   942 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonPatchImpl$1.class
  5214 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonPatchImpl$DiffGenerator.class
  4847 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonPatchImpl.class
   766 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonPointerImpl$1.class
  6728 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonPointerImpl.class
  4714 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonPrettyGeneratorImpl.class
  9577 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonProviderImpl.class
  1608 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonReaderFactoryImpl.class
  3146 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonReaderImpl.class
  2186 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonStringImpl.class
  1638 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonStructureParser$1.class
  1467 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonStructureParser$ArrayScope.class
  2174 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonStructureParser$ObjectScope.class
  1446 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonStructureParser$Scope.class
  5620 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonStructureParser.class
  2489 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonTokenizer$JsonToken.class
  9339 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonTokenizer.class
  1348 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonUtil.class
  1792 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonWriterFactoryImpl.class
   763 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonWriterImpl$1.class
   824 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonWriterImpl$NoFlushOutputStream.class
  4756 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/JsonWriterImpl.class
  2522 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/MapUtil.class
   760 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/NodeReference$1.class
  2465 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/NodeReference$ArrayReference.class
  2262 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/NodeReference$ObjectReference.class
  1665 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/NodeReference$RootReference.class
  1522 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/NodeReference.class
  3348 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/UnicodeDetectingInputStream.class
     0 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/api/
   172 Thu Feb 11 08:33:20 PST 2021 org/glassfish/json/api/BufferPool.class
  5300 Tue Aug 20 06:21:28 PDT 2019 org/glassfish/json/messages.properties
     0 Thu Feb 11 08:33:20 PST 2021 META-INF/maven/jakarta.json/
     0 Thu Feb 11 08:33:20 PST 2021 META-INF/maven/jakarta.json/jakarta.json-api/
   137 Tue Aug 20 06:29:16 PDT 2019 META-INF/maven/jakarta.json/jakarta.json-api/pom.properties
  6013 Tue Aug 20 06:22:42 PDT 2019 META-INF/maven/jakarta.json/jakarta.json-api/pom.xml

Josh Fisher

unread,
Feb 24, 2021, 12:40:40 PM2/24/21
to WildFly
Compare it to a 20 or 21 version of the JAR and there are a few differences:
  • META-INF/maven/org.apache.geronimo.specs is NOT there in 21 but is in 22
  • Various differences under javax/json, including size differences and absence/presence of anonymous classes such as for javax.json.spi.JsonProvider or javax.json.JsonValue
  • If you analyze the class files [I just opened in IntelliJ Idea] it appears 22 targets Java 6, which explains the NoSuchMethodError with JsonArray#getValuesAs(Function), while 21 targets Java 8.
I looked at the geronimo-json_1.0_spec-1.0-alpha-1.jar and it appears to match what I am seeing in the 22 wildfly-client-all.jar https://mvnrepository.com/artifact/org.apache.geronimo.specs/geronimo-json_1.0_spec/1.0-alpha-1

It looks like this may be coming from the org.apache.activemq:artemis-commons:2.16.0 artifact, which appears to be the version used starting in 22 and introduces the geronimo-json dependency that was not present in 21, which was using the 2.10.1 artemis-commons artifact.

I tested resolving/retrieving the wildfly-jms-client-bom artifact with Maven and it appears to bring in the geronimo-json, even though the POM appears to exclude it, which makes me think this could happen the same whether using the BOM or the wildfly-client-all artifact [provided you don't do your own conflict management].

Looking at the wildfly-jms-client-bom POM, which I am guessing is used as the basis for wildfly-client-all.jar, I notice there is this exclusion for org.apache.geronimo.specs artifacts:

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>artemis-core-client</artifactId>
    <version>${version.org.apache.activemq}</version>
    <exclusions>
...
      <exclusion>
         <artifactId>*</artifactId>
        <groupId>org.apache.geronimo.specs</groupId>
     </exclusion>
...
</dependency>

I think the problem is it is not also there for the org.apache.activemq:artemis-commons artifact where it appears to be coming from.

Josh Fisher

unread,
Feb 24, 2021, 5:30:19 PM2/24/21
to WildFly

Thank you for the response(s).

Emmanuel Hugonnet

unread,
Feb 25, 2021, 8:47:54 AM2/25/21
to Josh Fisher, WildFly
Can you try with the 23 Beta1 client  ? It should be ok
Cheers,
Emmanuel

Le 24/02/2021 à 23:30, Josh Fisher a écrit :
> Issue has been filed here: https://issues.redhat.com/browse/WFLY-14489
>
> Thank you for the response(s).
>
> On Wednesday, February 24, 2021 at 11:40:40 AM UTC-6 Josh Fisher wrote:
>
> Compare it to a 20 or 21 version of the JAR and there are a few differences:
>
> * META-INF/maven/org.apache.geronimo.specs is NOT there in 21 but is in 22
> * Various differences under javax/json, including size differences and absence/presence of anonymous classes such as for
> javax.json.spi.JsonProvider or javax.json.JsonValue
> * If you analyze the class files [I just opened in IntelliJ Idea] it appears 22 targets Java 6, which explains the NoSuchMethodError
> --
> You received this message because you are subscribed to the Google Groups "WildFly" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com
> <mailto:wildfly+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/wildfly/ed6bd6b3-c9f6-4872-b3a5-72bfc044302bn%40googlegroups.com
> <https://groups.google.com/d/msgid/wildfly/ed6bd6b3-c9f6-4872-b3a5-72bfc044302bn%40googlegroups.com?utm_medium=email&utm_source=footer>.


Josh Fisher

unread,
Mar 3, 2021, 12:18:49 PM3/3/21
to WildFly
Yes, I confirmed it is corrected in 23.0.0.Beta1 for both the JMS BOM and the wildfly-client-all.jar.

In the meantime for 22 I was able to work around in my client build by removing the old javax.json classes from wildfly-client-all.jar and replacing with the correct version or simply removing and having them on the classpath elsewhere, either way works.

Thank you for the response.
Reply all
Reply to author
Forward
0 new messages