Skip to content

Instantly share code, notes, and snippets.

@ldez
Last active August 29, 2015 13:58
Show Gist options
  • Save ldez/10012273 to your computer and use it in GitHub Desktop.
Save ldez/10012273 to your computer and use it in GitHub Desktop.
JAXB error "java.lang.StackTraceElement does not have a no-arg default constructor"
package com.ldez.myapp.support.exception;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
@XmlAccessorType(XmlAccessType.PROPERTY)
public abstract class AbstractTransientException extends Exception {
private static final long serialVersionUID = 1L;
@XmlTransient
@Override
public final StackTraceElement[] getStackTrace() {
// return null because StackTraceElement doesn't have no-arg contructor -> marshalling fail
return null;
}
@XmlTransient
@Override
public final synchronized Throwable getCause() {
// return null because marshalling fail
return null;
}
}
@ldez
Copy link
Author

ldez commented Apr 6, 2014

Dirty way but works...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment