2 Replies Latest reply on Sep 22, 2015 12:21 PM by James Perkins

    JsonProvider.createParser is not working in Wildfly?

    Ralph Soika Apprentice

      I have a strange problem with one of my applications during migration from GlassFish to Wildfly.

      The application makes use of the class  javax.json.stream.JsonParser:

       

        JsonParser parser = Json.createParser(new StringReader(json));
      

       

      when I run the code under Wildfly I got the following exception:

       

       

      ...

      Caused by: javax.ejb.EJBException: WFLYEJB0442: Unexpected Error

      .....

      Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "javax.json.spi.JsonProvider.createParser(Ljava/io/Reader;)Ljavax/json/stream/JsonParser;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, javax/json/Json, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, javax/json/spi/JsonProvider, have different Class objects for the type nParser; used in the signature

        at javax.json.Json.createParser(Json.java:90)

       

      So it looks like something is wrong with the javax.json library.

      As JsonParser is not part of the GlassFish environment, my project includes the dependency:

       

        <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.json</artifactId>
        <scope>compile</scope>
        </dependency>
      

       

      First I thought this should be easy to solve by removing this dependency because I read that Wilfldy (JEE7) includes

      the JsonParser.

       

      But also after I removed the library from my EAR /lib/ folder the same error occurs.

      Did anybody know what I missed here?

       

      Thanks for help

       

      ===

      Ralph