Andy Malakov software blog

Monday, June 2, 2008

JAXB error "java.lang.StackTraceElement does not have a no-arg default constructor"

Our Java-based XML service responds with exceptions in case of errors, so naturally it serializes subclasses of java.lang.Exception to XML.

Unfortunately JAXB 2.1.x fails when someone attempts to marshal a subclass of Exception:java.lang.StackTraceElement does not have a no-arg default constructor. This can be fixed using mechanism of JAXB Introductions. I just posted a fix here.