On Feb 12, 2009, at 9:59 AM, Srinivas Naresh Bhimisetty wrote:
> Hi,
> I was trying to create a simple library books catalog application,  
> and landed into the following issue:
>
> I have these classes:
> 1.
> @XmlType
> public class Book {
> ...
> }
> 2.
> @XmlElement
> public class Books {
>
>  protected List<Book> bookList;
>
> .....
> public Books addBook(Book book) {
>   ...
>  }
> }
> 3.
> @Path("books")
> public class BooksCatalog {
>  ....
>  @PUT
>  @Consumes("application/xml")
>  public Books addBookToCatalog(Book book)
> {
>
> }
>
> }
>
>    When I call this PUT method, the following error is thrown:
> A message body writer for Java type, class  
> com.sun.jersey.demo.objects.Book, and MIME media type, application/ 
> xml, was not found
>
> Now, the question is do we have to create a Writer for classes which  
> are annotated by @XmlType too?
> I thought its taken care of internally for JAXB annotated classes,  
> or is it just for the classes which are annotated by @XmlRootElement  
> that it is taken care of ? Please correct me if I'm wrong.
>
>  Note: I have tried this with NetBeans wizard, I think it uses  
> Jersey 1.0.1.
>
NetBeans uses Jersey 1.0.
In Jersey 1.0.1 @XmlType is support
See the sample:
   
http://download.java.net/maven/2/com/sun/jersey/samples/jaxb/1.0.1/jaxb-1.0.1-project.zip
Paul.