[JAXB] Wyjątek z 'no-arg default constructor' w polu z @XmlTransient

0

Witam.

Mam sobie prosty wyjątek, który chciałbym zapisać do XML'a:

public class Main {

    @XmlRootElement
    static public class SomeException extends RuntimeException {

        private Integer someAdditionalInformation;

        public SomeException() {
        }

        public SomeException(Integer someAdditionalInformation) {
            this.someAdditionalInformation = someAdditionalInformation;
        }

        public Integer getSomeAdditionalInformation() {
            return someAdditionalInformation;
        }

        public void setSomeAdditionalInformation(
            Integer someAdditionalInformation) {
            this.someAdditionalInformation = someAdditionalInformation;
        }

        @XmlTransient
        @Override
        public StackTraceElement[] getStackTrace() {
            return super.getStackTrace();
        }
    }



    public static void main(String[] args) {
        try {
            JAXBContext jaxbCtx = JAXBContext.newInstance(SomeException.class);
            Marshaller m = jaxbCtx.createMarshaller();
            m.marshal(new SomeException(5), System.out);
        } catch (JAXBException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

Ale dostaje wyjątek typu:

com.sun.xml.internal.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.Throwable
                at java.lang.Exception
                at java.lang.RuntimeException
                at jaxbtest.Main$SomeException

Czy to pachnie bugiem w JAXB ?
@XmlTransient powinien sprawić że JAXB w ogóle nie będzie się interesował tym atrybutem

Wie ktoś może jak obejść ten problem ?

0

bump

Naprawdę nikt nie ma żadnych hint'ów co zrobić w tym temacie ?

Pomagając z tym problemem wspomagacie projekt Jersey JAX-RS dla którego robię pewne rozszerzenie :)

0

A JAXB nie ma listy dyskusyjnej albo czegoś w tym rodzaju?

0

Jest ale tam również nie dostałem żadnej odpowiedzi.

Trochę jest tam zamieszania ostatnio bo migrują projekty na java.net na infrastrukturę kenai. Ogólnie niedługi pod java.net znajdzie się stare java.net + kenai w jednym

1 użytkowników online, w tym zalogowanych: 0, gości: 1