Hi

It does look like a JAXB issue, in fact CXF-2168 is about the same problem but 
it does seem to me it's a JAXB issue.
So you need to change Collection to say List in the CustomerCollection setter 
and it should work...

cheers, Sergey


Hi,

I am trying out some simple services using CXF JAX-RS bundle. I use maven to
build the war and am using cxf-bundle-jaxrs (ver 2.2).

But I am getting the above error. I have no idea what it means, can anyone
throw some light.

Below is the code

CustomerServices.java:
----------------------
@Path ("/customerservice")
@Produces ("application/xml")
public class CustomerServices {
   ..........
   ..........
   @GET
   @Path ("/get/all")
   public CustomerCollection getAllCustomers()  {
      try {
      return new
CustomerCollection(customerBusinessService.getAllCustomerDetails());
      }
      catch (CustomException e) {
      e.printStackTrace();
      throw new WebApplicationException(e,
Response.Status.INTERNAL_SERVER_ERROR);
      }
   }
}

CustomerCollection.java:
-----------------------
@XmlRootElement
public class CustomerCollection extends
AbstractCollectionWrapper<CustomerVO>
{
   public CustomerCollection()
   {
   }

   public CustomerCollection(Collection<CustomerVO> customerInfo)
   {
      super(customerInfo);
   }

   @XmlElement (name="Customer", type=CustomerVO.class)
   @XmlElementWrapper(name="Customers")
   public Collection<CustomerVO> getCustomerDetails()
   {
      return super.getCollection();
   }

   public void setCustomerDetails(Collection<CustomerVO> customerInfo)
   {
      super.setCollection(customerInfo);
   }
}

AbstractCollectionWrapper.java:
------------------------------
@XmlRootElement
public abstract class AbstractCollectionWrapper<T> {

  private Collection<T> collections;

  protected AbstractCollectionWrapper()
  {
  }

  protected AbstractCollectionWrapper(Collection<T> collections)
  {
     this.collections = collections;
  }

  protected Collection<T> getCollection()
  {
     return collections;
  }

  public void setCollection(Collection<T> users)
  {
     this.collections = users;
  }
}



LOG:
***************************

INFO: Inbound Message
----------------------------
Encoding: UTF-8
Content-Type:
Headers: {cache-control=[max-age=0], connection=[keep-alive],
accept-language=[en-us,en;q=0.5], host=[localhost:8080], k
eep-alive=[300], user-agent=[Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8
(.NET CLR 3.5.30729)], accept-encoding=[gzip,deflate],
Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,*/*
;q=0.8], accept-charset=[ISO-8859-1,utf-8;q=0.7,*;q=0.7]}
Payload:
--------------------------------------
Apr 16, 2009 10:34:39 AM org.apache.cxf.jaxrs.provider.AbstractJAXBProvider
handleJAXBException
WARNING: JAXBException occurred : 2 counts of IllegalAnnotationExceptions
Apr 16, 2009 10:34:39 AM
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: WebApplicationException has been caught : 2 counts of
IllegalAnnotationExceptions
Apr 16, 2009 10:34:39 AM
org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
INFO: Outbound Message
---------------------------
Encoding:
Content-Type: text/plain
Headers: {Content-Type=[text/plain]}
Payload: JAXBException occurred : 2 counts of IllegalAnnotationExceptions
--------------------------------------
Apr 16, 2009 10:34:39 AM
org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
INFO: Outbound Message
---------------------------
Encoding:
Content-Type: text/plain
Headers: {Content-Type=[text/plain]}
Payload: JAXBException occurred : 2 counts of IllegalAnnotationExceptions
--------------------------------------

--
View this message in context: http://www.nabble.com/JAXBException-occurred-%3A-2-counts-of-IllegalAnnotationExceptions-tp23080675p23080675.html
Sent from the cxf-user mailing list archive at Nabble.com.


Reply via email to