title: REST API Response
body: <p>I am creating restful web services. I need to get the Response of GET method as List of all Categories whose site Id is 1. when I run the following code it will not give the error</p>
  
  <pre><code>@GET
      @Produces("application/json")
      @Path("/bysite/{siteId}")
      public List&lt;Category&gt;getSubCategoryBySite(@PathParam("siteId") String siteId) {
         List&lt;Category&gt; categoryList = categoryFacade.retrieveCategory(Integer.parseInt(siteId));
          ParentCleaner parentCleaner=new ParentCleaner();
          Site site=parentCleaner.getEmptySite();
          for(int i=0;i&lt;categoryList.size();i++)
          {
              site.setSiteId(categoryList.get(i).getSiteId().getSiteId());
              categoryList.get(i).setSiteId(site);            
          }
          return categoryList;
      } 
  </code></pre>
  
  <p>but when i run the following code </p>
  
  <pre><code> @GET
          @Produces("application/json")
          @Path("/bysite/{siteId}")
          public Response getSubCategoryBySite(@PathParam("siteId") String siteId) {
             List&lt;Category&gt; categoryList = categoryFacade.retrieveCategory(Integer.parseInt(siteId));
              ParentCleaner parentCleaner=new ParentCleaner();
              Site site=parentCleaner.getEmptySite();
              for(int i=0;i&lt;categoryList.size();i++)
              {
                  site.setSiteId(categoryList.get(i).getSiteId().getSiteId());
                  categoryList.get(i).setSiteId(site);            
              }
              return Response.status(200).type(MediaType.APPLICATION_JSON).entity(categoryList).build();
          }
  </code></pre>
  
  <p>it gives the following error</p>
  
  <pre><code>SEVERE: A message body writer for Java class java.util.Vector, and Java type class java.util.Vector, and MIME media type application/json was not found
  SEVERE: The registered message body writers compatible with the MIME media type are:
  application/json -&gt;
    com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App
    com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$App
    com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$App
    com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
    com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$App
  */* -&gt;
    com.sun.jersey.core.impl.provider.entity.FormProvider
    com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
    com.sun.jersey.core.impl.provider.entity.StringProvider
    com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
    com.sun.jersey.core.impl.provider.entity.FileProvider
    com.sun.jersey.core.impl.provider.entity.InputStreamProvider
    com.sun.jersey.core.impl.provider.entity.DataSourceProvider
    com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
    com.sun.jersey.core.impl.provider.entity.ReaderProvider
    com.sun.jersey.core.impl.provider.entity.DocumentProvider
    com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
    com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
    com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
    com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
    com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
    com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
    com.sun.jersey.json.impl.provider.entity.JSONWithPaddingProvider
    com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
    com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
    com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
    com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
    com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy
    com.sun.jersey.moxy.MoxyMessageBodyWorker
    com.sun.jersey.moxy.MoxyListMessageBodyWorker
  
  SEVERE: Mapped exception to response: 500 (Internal Server Error)
  javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class java.util.Vector, and Java type class java.util.Vector, and MIME media type application/json was not found
      at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
      at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:619)
  Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class java.util.Vector, and Java type class java.util.Vector, and MIME media type application/json was not found
      ... 32 more
  </code></pre>