title: Returning a list of javax.ws.rs.core.Response resulting in 500
body: <p>I am trying to return an ArrayList of Response objects from my rest end point. </p>
  
  <p>To do so I am wrapping my result set inside of a Generic Entity object</p>
  
  <pre><code>try {
      GenericEntity&lt;List&lt;Response&gt;&gt; response = new GenericEntity&lt;List&lt;Response&gt;&gt;(responses) {
      };
      return Response.ok(response).build();
  } catch (Exception e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>No matter what I try I get a 500 back which is frustrating. Is there a way I can get a more definitive answer as to why this is failing? The annotations used for my method are as follows;</p>
  
  <pre><code>@POST
  @Path("restendpoint")
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  </code></pre>
  
  <p>Thanks</p>
  
  <p><strong>edit</strong></p>
  
  <p>After adding a custom exception mapper i can see the error is because of this</p>
  
  <pre><code>javax.ws.rs.WebApplicationException: HTTP 500 Internal Server Error
      at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.writeTo(MOXyJsonProvider.java:951)
      at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
      at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
      at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
      at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
      at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
      at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
      at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
      at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
      at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
      at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
      at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
      at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
      at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
      at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:769)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      at org.eclipse.jetty.server.Server.handle(Server.java:497)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
      at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539)
      at java.lang.Thread.run(Thread.java:744)
  Caused by: javax.xml.bind.MarshalException
   - with linked exception:
  [Exception [EclipseLink-25007] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.XMLMarshalException
  Exception Description: A descriptor for class org.glassfish.jersey.message.internal.OutboundJaxrsResponse was not found in the project.  For JAXB, if the JAXBContext was bootstrapped using TypeMappingInfo[] you must call a marshal method that accepts TypeMappingInfo as an input parameter.]
      at org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:487)
      at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.writeTo(MOXyJsonProvider.java:949)
      ... 40 more
  Caused by: Exception [EclipseLink-25007] (Eclipse Persistence Services - 2.6.0.v20150309-bf26070): org.eclipse.persistence.exceptions.XMLMarshalException
  Exception Description: A descriptor for class org.glassfish.jersey.message.internal.OutboundJaxrsResponse was not found in the project.  For JAXB, if the JAXBContext was bootstrapped using TypeMappingInfo[] you must call a marshal method that accepts TypeMappingInfo as an input parameter.
      at org.eclipse.persistence.exceptions.XMLMarshalException.descriptorNotFoundInProject(XMLMarshalException.java:154)
      at org.eclipse.persistence.internal.oxm.Context$ContextState.getSession(Context.java:137)
      at org.eclipse.persistence.oxm.XMLContext$XMLContextState.getSession(XMLContext.java:798)
      at org.eclipse.persistence.oxm.XMLContext$XMLContextState.getSession(XMLContext.java:1)
      at org.eclipse.persistence.internal.oxm.Context.getSession(Context.java:458)
      at org.eclipse.persistence.oxm.XMLContext.getSession(XMLContext.java:366)
      at org.eclipse.persistence.oxm.XMLContext.getSession(XMLContext.java:1)
      at org.eclipse.persistence.internal.oxm.XMLMarshaller.marshal(XMLMarshaller.java:582)
      at org.eclipse.persistence.internal.oxm.XMLMarshaller.marshalStreamOrWriter(XMLMarshaller.java:1126)
      at org.eclipse.persistence.internal.oxm.XMLMarshaller.marshal(XMLMarshaller.java:934)
      at org.eclipse.persistence.internal.oxm.XMLMarshaller.marshal(XMLMarshaller.java:877)
      at org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:483)
      ... 41 more
  </code></pre>