title: DSL-Json with RESTEasy - Getting NoMessageBodyWriterFoundFailure error
body: <p>I'm integrating RestEasy with Dsl-JSON but I'm getting the following error: </p>
  
  <blockquote>
    <p>Failed executing GET /json/sample/get         org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type</p>
  </blockquote>
  
  <p>My code is as below:</p>
  
  <pre><code>@Path("/json/sample")
  public class JSONService {
  
      @GET
      @Path("/get")
      @Produces(MediaType.APPLICATION_JSON)
      public Sample getProductInJSON() {
  
          Sample product = new Sample();
          product.setName("abcd");
          product.setAge(12);
  
          return product; 
      }
  }
  </code></pre>
  
  <p>My pom looks like this:</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.dslplatform&lt;/groupId&gt;
          &lt;artifactId&gt;dsl-json&lt;/artifactId&gt;
          &lt;version&gt;1.0.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.dslplatform&lt;/groupId&gt;
          &lt;artifactId&gt;dsl-json-processor&lt;/artifactId&gt;
          &lt;version&gt;0.9&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;resteasy-jaxrs&lt;/artifactId&gt;
          &lt;version&gt;3.0.16.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;resteasy-client&lt;/artifactId&gt;
          &lt;version&gt;3.0.16.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
          &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
          &lt;version&gt;2.0.1&lt;/version&gt;
      &lt;/dependency&gt;
   &lt;/dependencies&gt;
    &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;annotationProcessors&gt;                  &lt;annotationProcessor&gt;com.dslplatform.json.CompiledJsonProcessor&lt;/annotationProcessor&gt;
              &lt;/annotationProcessors&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;    
  </code></pre>
  
  <p>The same rest endpoint was working with Jackson but I want to use DSL-Json and integrate it with RestEasy. The mvn build is succcesful and I see the <code>ExternalSerialization</code> class being generated for all the <code>@CompiledJson</code> objects.</p>
  
  <p>I'm passing application/json in the headers.</p>
  
  <p>Any leads would be greatly appreciated.</p>
  
  <p>Thank you :)</p>
  
  <p>The messageBodyReader class is as below:</p>
  
  <pre><code>@Provider
  @Produces("application/json")
  public class MyMessageBodyWriter implements MessageBodyWriter&lt;Object&gt; {
  
      @Override
      public boolean isWriteable(Class type, Type genericType,
              Annotation[] annotations, MediaType mediaType) {
          System.out.println("isWriteable called...");
          return  Sample.class == type; 
      }
  
      @Override
      public long getSize(Object arg0, Class&lt;?&gt; arg1, Type arg2,
              Annotation[] arg3, MediaType arg4) {
          return -1;
      }
  
  
      @Override
      public void writeTo(Object t, Class&lt;?&gt; type, Type genericType,
              Annotation[] annotations, MediaType mediaType,
              MultivaluedMap&lt;String, Object&gt; httpHeaders,
              OutputStream entityStream) throws IOException,
              WebApplicationException {
  
          @SuppressWarnings("resource")
          JsonWriter writer = new JsonWriter();
          entityStream.write(writer.getByteBuffer());     
      }
  }
  </code></pre>
  
  <p>And MyMessageBodyReader is like this:</p>
  
  <pre><code>@Provider
  public class MyMessageBodyReader extends DslJson implements    MessageBodyReader&lt;Object&gt; {
  
      @SuppressWarnings("unchecked")
      @Override
      public Object readFrom(Class type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType,
              MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
          return "Successfuly read ";
      }
  
      @Override
      public boolean isReadable(Class&lt;?&gt; arg0, Type arg1, Annotation[] arg2,
              MediaType arg3) {
          // TODO Auto-generated method stub
          return false;
      }
  }
  </code></pre>
  
  <p>I'm unable to invoke these Providers when the rest endpoint is hit, I tried using<br>
  Application Class getClasses method: </p>
  
  <pre><code>public Set&lt;Class&lt;?&gt;&gt; getClasses() {
      Set&lt;Class&lt;?&gt;&gt; classes = new HashSet&lt;Class&lt;?&gt;&gt;();
      classes.add(MyMessageBodyReader.class);
      classes.add(MyMessageBodyWriter.class);
      return classes;
  }
  </code></pre>
  
  <p>But it's not registering these classes.</p>
  
  <p>RestEasy Configuration : web.xml file</p>
  
  <pre><code>    &lt;context-param&gt;
      &lt;param-name&gt;resteasy.resources&lt;/param-name&gt;
      &lt;param-value&gt;com.x.y.rest.JSONService&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;
          org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;resteasy-servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;
          org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;resteasy-servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>