title: Jersey: A message body writer for Java Class and MIME mediatype application/json was not found
body: <p>after trying to figure out what's my problem I finally decided to ask you how to solve my problem. I've seen different people with the same problem and I tried all the things they were adviced to do but nothing helped with my issue. So basically I'm having a RESTful Service which I build using Jersey. For my client I would like to return an object in JSON Format. I read through different tutorials and decided that it makes sense to use jersey-json-1.8 library. I added everything to my project as usual and tried to run it but each time I'm calling the service (via get request atm.) I'm getting HTTP Error Code 500 (internal server error) and my server responds that no message body writer could be found. 
  If I'm returning XML it works just fine and everything is great. I also tried copying jersey-json-1.8.jar to my Tomcat lib folder because I had to do this with the mysql lib I'm using but it didn't help either.
  I would be really glad if you could help me out to get this stuff working! 
  If you need any more information just leave a comment and I'll provide it as quickly as humanly possibly :)</p>
  
  <p>My project setup is:
  3 Different packages
  1. My RESTfulServices
  2. My Java Work where i handle SQL connections etc.
  3. A package where I store all my models that I need to work with and that I want to return in JSON Format (in my example a route for a testdrive)</p>
  
  <p>A Tomcat Webserver
  IDE: Eclipse
  I'm using Maven</p>
  
  <p>No matter what or how I'm trying to return the Object it just won't work and I'm constantly getting the error message :</p>
  
  <pre><code>Mapped exception to response: 500 (Internal Server Error)
  javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class com.mykong.models.Teststrecke, and Java type class com.mykong.models.Teststrecke, and MIME media type application/json was not found
  </code></pre>
  
  <p>EDIT: 
  Here's my JSON Service Method</p>
  
  <pre><code>@Path("/hellojson")
  public class JSONService {
  
  
      @GET
      @Produces(MediaType.APPLICATION_JSON)
      public ArrayList&lt;Route&gt; getJSONMsg()  
      {
  
          Route ts = new Route();
          ts.setId(1);
          ts.setName("HelloWorld");
  
  
          Route ts2 = new Route();
          ts2.setId(2);
          ts2.setName("HelloWorld");
  
  
          ArrayList&lt;Route&gt; availRoutes = new ArrayList&lt;Route&gt;();
          availRoutes.add(ts);
          availRoutes.add(ts2);
  
  
          return availRoutes;
  
  
      }
  }
  </code></pre>