I am trying to use openfire REST-API-Client. I am calling method to add user to the openfire using following code.
AuthenticationToken authenticationToken = new AuthenticationToken("username","password");
RestApiClient restApiClient = new RestApiClient("url",port, authenticationToken);
UserEntity openFireUser = restApiClient.getUser(user.getUsername());
When I call the api I get following exception.
org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=text/html;charset=UTF-8, type=class org.igniterealtime.restclient.entity.UserEntity, genericType=class org.igniterealtime.restclient.entity.UserEntity.
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:231)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:155)
at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1085)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:874)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:808)
at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:326)
at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:115)
I googled and it looks there is some problem with the dependencies. But nothing worked.
Below is my build.gradle
compile(group: 'org.igniterealtime', name :'rest-api-client', version: igniterealtime_rest_api_version){
exclude group: 'org.slf4j', module: 'slf4j-simple'
exclude group: 'org.slf4j', module: 'slf4j-api'
}
I also, tried adding following dependencies to my build.gradle, but it did not work.
compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.23'
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: '2.2'
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-moxy', version: '2.24'
compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.4.1'
text/html
which, obviously, cannot be parsed into a user entity. This most likely happens either due to not receiving a successful response (200 OK) or due to connecting to the wrong URL. – Indicationorg.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=text/html;charset=UTF-8, type=interface java.util.Map, genericType=interface java.util.Map.
Could you please explain how did you fix your issue? – Sergo