cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernhard Mähr (JIRA) <>
Subject [jira] [Created] (CXF-6656) [Regression] Inheritance of exceptions produces marshalling problems
Date Thu, 29 Oct 2015 14:34:27 GMT
Bernhard Mähr created CXF-6656:

             Summary: [Regression] Inheritance of exceptions produces marshalling problems
                 Key: CXF-6656
             Project: CXF
          Issue Type: Bug
    Affects Versions: 3.1.3
            Reporter: Bernhard Mähr

We have services throwing exceptions inherited from super classes.

For example:

public class MyException extends org.springframework.dao.DataAccessException { .. }

Throwing this exception leads to 
Caused by: javax.xml.bind.JAXBException: java.lang.Throwable is not known to this context
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getBeanInfo(
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(
	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshallException(

The problem is the method getMostSpecificCause returning an object of type Throwable. 
In older versions (2.4.10) the superclasses of the exception were not processed by JAXBEncoderDecoder.marshallException,
only the getters of the actual class.
Now the method Utils.getGetters is used to get the list of getters and it returns also getters
of superclasses. 
It is not possible to avoid marshalling of the method getMostSpecificCause with XmlTransient
because even if it is overidden in the actual class, Utils.getGetters returns the method off
the superclass. This is because only annotations of the method of the superclass are checked.

This message was sent by Atlassian JIRA

View raw message