title: RESTEasy client. could not find writer for content-type application/xml
body: <p>I am trying to connect to a web-service with RESTeasy.</p>
  
  <p>The code I am using is this:</p>
  
  <pre><code>WebTarget resource = client.target(URL_DISPLAY);
  Builder request = resource.request(MediaType.APPLICATION_XML);
  
  long startTime = System.currentTimeMillis();
  ClientResponse response = (ClientResponse)request.post(Entity.xml(text));
  </code></pre>
  
  <p>The program is working as soon as I run it in eclipse.</p>
  
  <p>When I generate a runnable jar, or even run java from the console it does not work. The stack trace is the following:</p>
  
  <pre><code>javax.ws.rs.ProcessingException: Unable to invoke request
      at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:287)
      at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:407)
      at org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.post(ClientInvocationBuilder.java:195)
      at webservices.WebServicesTest.requestDisplay(WebServicesTest.java:144)
      at webservices.WebServicesTest.main(WebServicesTest.java:328)
  Caused by: javax.ws.rs.ProcessingException: could not find writer for content-type application/xml type: webservices.DisplayText
      at org.jboss.resteasy.core.interception.ClientWriterInterceptorContext.throwWriterNotFoundException(ClientWriterInterceptorContext.java:40)
      at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.getWriter(AbstractWriterInterceptorContext.java:138)
      at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:117)
      at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.aroundWriteTo(GZIPEncodingInterceptor.java:100)
      at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122)
      at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.writeRequestBody(ClientInvocation.java:341)
      at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.writeRequestBodyToOutputStream(ApacheHttpClient4Engine.java:558)
      at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.buildEntity(ApacheHttpClient4Engine.java:524)
      at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.loadHttpMethod(ApacheHttpClient4Engine.java:423)
      at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:281)
      ... 4 more
  </code></pre>
  
  <p>The DisplayText class is defined as follows:</p>
  
  <pre><code>@XmlRootElement
  public class DisplayText implements Serializable
  </code></pre>
  
  <p>I added in my pom the following packages:</p>
  
  <ul>
  <li>resteasy-client</li>
  <li>resteasy-jaxrs</li>
  <li>resteasy-jaxb-provider
    (version 3.0.8.Final)</li>
  <li>com.sun.xml.bind</li>
  </ul>
  
  <p>all of them scoped in runtime.</p>
  
  <p>What I find strange is that it works under eclipse. Is it maybe some Jaxb configuration? or context settings.
  I also tried </p>
  
  <pre><code>   RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
  </code></pre>
  
  <p>and it didn't work.</p>