In a REST client written using JAX-RS and RestEasy as implementation I'm trying the send a JsonObject via POST to a WebService. The project uses the reference implementation of JSON-P, org.glassfish.javax.json.
When I'm trying the send the request I get the following exception:
javax.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type application/json type: org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl
The following artifacts are present in the pom.xml:
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.6.3.SP1</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.6.3.SP1</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-p-provider</artifactId>
<version>3.6.3.SP1</version>
</dependency>
From what I've read in the documentation that should be all necessary.
The request in invoked as follows:
final JsonObjectBuilder credentialsBuilder = Json.createObjectBuilder();
credentialsBuilder.add("username", configuration.getServiceUser());
credentialsBuilder.add("password", configuration.getServicePassword());
final Entity<JsonObject> credentials = Entity
.json(credentialsBuilder.build());
final Response response = ClientBuilder
.newClient()
.target("http://www.example.org/some/url")
.request(MediaType.APPLICATION_JSON)
.post(credentials);
What I'm missing?