I am trying to send json in my REST POST, yet when I try to pass a List to the writer, the interceptor that sets the MessageBodyWriter comes up with nothing and throws an exception. I am using the Moxy provider. Any help?
List<AMCRegistration> customers = new ArrayList<>();
customers.add(myReg);
Client client = ClientBuilder.newClient();
HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("user", "pass");
client.register(feature);
WebTarget target = client.target("https://foosvc.foo.org/api/amc");
target = target.path("PostFOO");
// Exception thrown here
String postResponse = target.request(MediaType.APPLICATION_JSON)
.post(Entity.entity(customers, MediaType.APPLICATION_JSON),String.class);
Apr 16, 2021 11:29:02 AM org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo
SEVERE: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=class java.util.ArrayList.
Exception in thread "main" org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=class java.util.ArrayList.
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>