JAXB custom exception marshalling error
I have a library containing beans that are passed between the server and the client application. It also contains a custom exception class:
public class MyServiceException extends Exception{
private int code;
private String description;
public MyServiceException(int code, String description){
super(code + ": " + description);
this.code = code;
this.description = description;
}
public int getCode() {
return code;
}
public String getDescription() {
return description;
}
}
When the server throws the exception, this happens on the client:
org.apache.cxf.interceptor.Fault: Marshalling Error: MyServiceException.<init>(java.lang.String)
..........
Caused by: java.lang.NoSuchMethodException: MyServiceException.<init>(java.lang.String)
if I add a no-arg constructor to the exception class it works, but the code and description fields are 0 and null. They are however present in the super class detailsMessage. I don't have this problem with any of the other beans. Implementing Serializable did not help. What am I missing?
问题在于该班缺少二手设备。
链接地址: http://www.djcxy.com/p/41862.html上一篇: JAXB在处理ArrayList时无效的XML结构
下一篇: JAXB自定义异常编组错误