How to build list of entity in RESTful response

@GET
@Path("/books")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response allBooks() {

// Given a list of books
List<Book> books = new ArrayList<Book>();

books.add(new Book("1190","Mind Your Steps"));
books.add(new Book("2287","Look Up"));

GenericEntity entity = new GenericEntity<List<Book>>(books){};

return Response.ok(entity).build();
//return Response.ok().entity(entity).build();
}

Trying to build a list while response, but i am not getting the result. It's showing "The server encountered an internal error that prevented it from fulfilling this request." Please help me.

Or should i need to follow some other approach for return multiple rows in RESTful API response