title: JBoss + RestEasy + Jackson : org.jboss.resteasy.core.ServerResponse cannot be cast to org.jboss.resteasy.specimpl.BuiltResponse
body: <p>I work on a REST Api with JBoss (AS 7.1), RestEasy and Jackson. The web service return an "Account" object, it's a simple POJO that used to be serialized in JSon without any problem.</p>
  
  <p>After some modifications in the code, the server pop an exception after each call to my method. The execution of :</p>
  
  <pre><code>@POST
  @Path("/auth")
  @Produces(MediaType.APPLICATION_JSON)
  public Account authentification(final Account account) throws AuthenticationException {
      Logger.debug(this, "Authenticate");
      Account returnedAccount = // Some authentication code that build a correct Account object
      Logger.debug(this, "Authenticated, return now !");
      return returnedAccount;
  }
  </code></pre>
  
  <p>Print an output as following :</p>
  
  <pre><code>(DEBUG) Authenticate
  (DEBUG) Authenticated, return now !
  (ERROR) java.lang.ClassCastException: org.jboss.resteasy.core.ServerResponse cannot be cast to org.jboss.resteasy.specimpl.BuiltResponse
      at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:340)
      at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:234)
      at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:221)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)
      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
      at com.mypackage.filter.MyFilter.doFilter(MyFilter.java:55)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>The only thing i found on google was <a href="https://issues.jboss.org/browse/KEYCLOAK-256" rel="nofollow">this ticket</a> on JBOSS issues tracker but it doesn't help much.</p>
  
  <p>Any help would be much appreciated !</p>