Millies, Sebastian wrote:
but that should not be a problem here. I am not throwing an exception,

I am simply passing one as a method parameter. -- Sebastian

All parameters need to follow the JAXB rules.  One of these rules is
that any class mapped to JAXB must have a no-argument constructor.
The Throwable class has a getStackTrace() method that returns a
StackTraceElement[] array, and StackTraceElement doesn't have a
no-argument contructor.

To solve this problem you can use @XmlJavaTypeAdapter to marshal the
Throwable class (or any subclass of Throwable) using some other class
that conforms to the JAXB rules.  I haven't had time yet to find out
why @XmlJavaTypeAdapter isn't working in Tuscany 1.6.

  Simon
*From:* Raymond Feng [mailto:[email protected]]
*Sent:* Tuesday, September 14, 2010 12:32 AM
*To:* [email protected]
*Subject:* Re: Throwable as method argument causes exception

For remotable interfaces, SCA uses JAX-WS conventions to generate the WSDL from Java. And JAX-WS requires the (business, checked) exception to be mappable into a "fault" bean.

Thanks,

Raymond

________________________________________________________________
Raymond Feng

[email protected] <mailto:[email protected]>
/Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com/

________________________________________________________________

On Sep 13, 2010, at 3:25 PM, Millies, Sebastian wrote:



As soon as I add an argument of type java.lang.Throwable to one of
my service methods, I get an error upon activation:

WARNUNG: Exception while generating WSDL for CurrencyConverter/CurrencyConverter 14.09.2010 00:11:23 org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator SCHWERWIEGEND: Exception thrown was: org.osoa.sca.ServiceRuntimeException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
            this problem is related to the following location:
                        at java.lang.StackTraceElement
at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
                        at java.lang.ThrowableThis

This is really bad. Where is this documented? Does every nested property of every method
argument have to have a no-arg constructor?

This makes the implementation of an SCA LogService in Tuscany 1.6 practically impossible, if
one cannot even pass in an exception object.

-- Sebastian


Reply via email to