You're probably will need to make the exception look like a "jaxws generated" 
exception to get the collections to work correctly.   Basically, define a JAXB 
bean that looks like what you want serialized in the details, add a @WebFault 
annotation, and add a "bean getFaultDetails()" method that returns that bean.   
That bean can have all the lists and such.  

Dan


On Fri August 7 2009 12:19:49 pm D'Arcy, Hamlet B wrote:
> I want to throw a custom exception from a CXF service.
>
> The exception class has a List<Failure> field in it. Failure is a
> properly JAXB annotated class.
>
> Here is one way to write this exception:
>
>   public class ValidationException extends RuntimeException {
>     private List<Failure> failures;
>
>     ... Getters/setters omitted
>   }
>
>
> I can't get this custom exception to serialize properly.
>
> I tried subclassing SoapFault and adding fields, but the list was never
> serialized.
>
> I tried subclassing RuntimeException and annotating the custom fields,
> but getStackTrace/setStackTrace on the parent class can't be serialized.
>
>
> How can I throw an exception from a CXF service that has a List<Failure>
> field?
>
> --
> Hamlet D'Arcy
> [email protected]
> +1(952)681-3636

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to