Unable to find a MessageBodyReader of content-type application/json and type class java.lang.String

前端 未结 8 681
野的像风
野的像风 2020-12-01 18:20

I am using RestEasy client with jackson providers and getting the above error

clientside code is:

ClientRequest request = new ClientRequest(url);
re         


        
8条回答
  •  暖寄归人
    2020-12-01 18:40

    Things that had made work my code were that I added:

    
        org.jboss.resteasy
        resteasy-jackson2-provider
        &{resteasy.version}
    
    

    Beside this I don't know why but it seems that resteasy not initializing providers when client were created, this means that it required to init them manually:

     ResteasyProviderFactory instance=ResteasyProviderFactory.getInstance();
     RegisterBuiltin.register(instance);
     instance.registerProvider(ResteasyJackson2Provider.class);
    

    In general it's enough to run the client.

提交回复
热议问题