Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1827

JSON-B provider requires to add JSON-P dependency on client side

    XMLWordPrintable

Details

    Description

      Description of the issue:
      JSON-B provider requieres to add JSON-P dependency on client side

      Steps to Reproduce:

      1. Prepare client application (you can use RESTEASY-1827.zip )
      2. Use these dependencies
            <dependencies>
                <dependency>
                    <groupId>org.jboss.resteasy</groupId>
                    <artifactId>resteasy-client</artifactId>
                    <version>3.5.1-SNAPSHOT</version>
                </dependency>
                <dependency>
                    <groupId>org.jboss.resteasy</groupId>
                    <artifactId>resteasy-json-binding-provider</artifactId>
                    <version>3.5.1-SNAPSHOT</version>
                </dependency>
                <!--dependency>
                    <groupId>org.jboss.resteasy</groupId>
                    <artifactId>resteasy-json-p-provider</artifactId>
                    <version>3.5.1-SNAPSHOT</version>
                </dependency-->
            </dependencies>
        
      3. Use this Main class
        public class App {
            public static void main(String[] args) {
                Client client = ClientBuilder.newClient();
                client.close();
            }
        }
        

      Actual results:

      Mar 05, 2018 2:14:31 PM org.jboss.resteasy.plugins.providers.RegisterBuiltin registerProviders
      WARN: RESTEASY002145: NoClassDefFoundError: Unable to load builtin provider org.jboss.resteasy.plugins.providers.jsonb.JsonBindingProvider from jar:file:/home/mkopecky/.m2/repository/org/jboss/resteasy/resteasy-json-binding-provider/3.5.1-SNAPSHOT/resteasy-json-binding-provider-3.5.1-SNAPSHOT.jar!/META-INF/services/javax.ws.rs.ext.Providers
      java.lang.NoClassDefFoundError: org/glassfish/json/JsonProviderImpl
      	at java.lang.Class.getDeclaredConstructors0(Native Method)
      	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
      	at java.lang.Class.getConstructors(Class.java:1651)
      	at org.jboss.resteasy.util.PickConstructor.pickSingletonConstructor(PickConstructor.java:30)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.createConstructorInjector(ResteasyProviderFactory.java:2682)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2674)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyReader(ResteasyProviderFactory.java:953)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1706)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1637)
      	at org.jboss.resteasy.plugins.providers.RegisterBuiltin.registerProviders(RegisterBuiltin.java:133)
      	at org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:45)
      	at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.getProviderFactory(ResteasyClientBuilder.java:359)
      	at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.build(ResteasyClientBuilder.java:392)
      	at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.build(ResteasyClientBuilder.java:38)
      	at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:121)
      	at com.resteasy.test.App.main(App.java:8)
      Caused by: java.lang.ClassNotFoundException: org.glassfish.json.JsonProviderImpl
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      	... 16 more
      

      Expected results:
      No exception on output

      Additional info:
      Workaround is to add resteasy-json-p-provider dependency, but:

      • it is user unfriendly and non-intuitive
      • Json-p should not be necessary for json-b, so there is probably some hidden issues with JSON-B provider.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-asoldano Alessio Soldano
              mkopecky@redhat.com Marek Kopecky
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: