Answer the question
In order to leave comments, you need to log in
Why am I getting Exception MessageBodyWriter not found?
I get the error " MessageBodyWriter not found " using Maven, javax.ws.rs-api-2.0.1.jar which contains this Interface .. What could be wrong ? Not the correct construction of the client?
Nov 10, 2016 3:33:50 PM org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo
SEVERE: MessageBodyWriter not found for media type=application/json, type=class coupon.beans.User, genericType=class coupon.beans.User.
Exception in thread "main" org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=application/json, type=class coupon.beans.User, genericType=class coupon.beans.User.
public class ApplTest {
private static final String REGISTRATION_PATH = "http://localhost:9191/CouponProject/register";
public static void main(String[] args) {
WebTarget webTarget = ClientBuilder.newClient().target(URI.create(REGISTRATION_PATH));
Response response = webTarget
.request()
.accept(MediaType.APPLICATION_JSON)
.acceptEncoding("UTF-8")
.acceptLanguage(Locale.ENGLISH)
.buildPost(Entity.entity(new User("Nick","Name","Lastname","123456","[email protected]","Customer")
,MediaType.APPLICATION_JSON)).invoke();
System.out.println(response.toString());
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question